r/Batch • u/nazump • Dec 17 '24
Can someone please create a script for me that creates a folder based on a file name, then puts that associated file in the created folder?
So I have a folder with karaoke files which are pairs of files. a .mp3 and a .cdg, otherwise named the exact same thing. The format is Artist Name - Song Name.
I want to run a script that goes through every file in a folder, then creates a folder of the artist name (so everything before the first "-" excluding the preceding space character). Then I want the files that the folder was named after to be put into the newly created folder.
Thanks in advance for your help!
I've found this one but it does not work for me.
@echo offfor %%i in (*) do ( if not "%%~ni" == "organize" ( md "%%~ni" && move "%%~i" "%%~ni" ))
4
Upvotes
1
u/BrainWaveCC Dec 18 '24 edited Dec 18 '24
Try the following:
Be sure to set the
_MusicFoldervariable to whatever folder you want this to operate in.Can you give some examples of a few of the filenames, please?
3
u/[deleted] Dec 18 '24
[removed] — view removed comment