Move file folder using a keyboard shortcut?

What I’m trying to do

Hi all, I’m trying to create a keyboard shortcut that can move a file’s folder to a specified location.

I’m familiar with the Ctrl+M shortcut to move individual files, though I was thinking of setting something like a Ctrl+Shift+M shortcut that I would run on a file to move the entire folder that the file is in to a specified location.

For example, I have this file structure:

  • /
    • Areas/
    • Folder A/
      • File1
      • File2
      • File3

I open up File1, press Ctrl+Shift+M, the move prompt comes up, I type in “Areas”, press Enter, and then the entire folder and all of its files moves to the “Areas” folder.

  • /
    • Areas/
      • Folder A/
        • File1
        • File2
        • File3

Things I have tried

I’ve been looking into the Templater documentation as well as the Obsidian API declaration file and I can’t see a way of bringing up the move file dialogue that I’m familiar with.

Ideally I would bring this dialogue window up, get the output, and then add some code to move the entire folder to the returned location.

Alternatively I could create a feature request for this, though I don’t want to have to wait around for that to be implemented over all of the other things the team are doing.


I figured it out!

You can use this Templater script:

let folders = await app.vault.getAllLoadedFiles()
	.filter(x => x instanceof tp.obsidian.TFolder);

let move_to_folder = await tp.system.suggester( => f.path), folders, false, "", 20);

if (move_to_folder !== null) {
	let my_folder_path = tp.file.folder(true);
	let my_folder = app.vault.getAbstractFileByPath(my_folder_path);
	let folder_name =;
	let new_folder_name =;
	let new_folder_path = move_to_folder.path + "/" + folder_name;
	// move folder to new path
	await app.vault.rename(my_folder, new_folder_path);
	new Notice('Successfully moved ' + folder_name + ' to ' + new_folder_name, 2800);

The key here was tp.system.suggester, which allows you to create a dialogue similar to the move note dialogue in Templater.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.