If I want to move all files matching a tag from one folder to another, what’s the easiest way to do that? Drag’n’drop from the search result doesn’t work.
Question: Do your file names have
spaces / tabs / or quotes ??
If not, what i usually do is the following:
- Type the search
- Copy Search results (the obsidian icon option)
- !IMP! choose show path option
- Copy the list into a text file for e.g.
- Run the following shell command:
cat PATH/TO/move.txt | xargs -I % sh -c 'echo \"PATH/TO/YOUR/VAULT/%\";' | xargs -I % sh -c 'cp -rf % PATH/TO/DESTINATION/FOLDER/'
- if your names have spaces and other path breaking characters you need to search / replace all of them to escape them before running the command otherwise the paths will be broken.
- The path has to be either the absolute path or the relative path from where you are running the command. You need to replace
PATH/TO/DESTINATION/FOLDER/from the above command (keep everything else)
- I am sorry if this is not what you are looking for
- If you are using the third-party-plugin https://github.com/cristianvasquez/obsidian-snippets-plugin you can run this from inside a note within your vault just be careful where the path is currently (if you do use it, the current directory is the root).
This is from inside the note
To see where you are run the print working directory command below
You can do the same thing using python instead of sh and
**it wouldn't care about spaces / characters.**
I can share it if it is what you want please let me know.
Thanks. With 1600 files this process would probably take a lot of time. But for some reason, it made me realize that I could just use Finder to search for the relevant tags and make the move there. So, thanks!
Hello, I’d be interested if you could share how I can do that using python. I want to move a lot of notes and all of them have spaces in their titles…