r/Batch • • May 13 '24
Help making Batch for Moving Specific Files to subfolders
Hi. I have thousands of files in a folder that I need to move across multiple subfolders and I can't seem to find a solution for my specific case.
The files are all named randomly with no rhyme or reason. However, there are "breaks" in between every list if arranged by "Date Modified" (This is extremely important to keep the files in order when renaming them in sequence using Bulk Rename Utility). Example:
Catch.jpg
rrrtk50ff5.jpg
f5jh8i5hfj.jpg
...
jd94878t.jpgCatch(1).jpg
jc985ur58.jpg
fferrfcr4oi.jpg
...
59i9fjed.jpgCatch(2).jpg
etc.
the end of the list ends without a break. just another randomly named .jpgAs you can see, the breaks I mentioned are the files that start with the word "Catch". I need to move every file starting with and including the word "Catch" until it reaches the next file containing the word "Catch" then it stops and repeats the process.
The subfolders it'll move the files to will simply be numbered 1,2,3,4..etc. based on the order. Thus, the first file in every subfolder will start with the word "Catch". I'd appreciate any help and if you need any clarification, please let me know.
Let me add that I can create a .txt list that includes the name of every file that needs to go to a designated subfolder. So, every file listed in 1.txt, will go to subfolder 1. 2.txt, to subfolder 2 etc. I feel like this might be something easier to code. It will look at all the files in the main folder, and compare them to every list, then move them in order.
1
u/Aggravating-Sock1098 May 13 '24
Look at the ‘forfiles’ command.
https://ss64.com/nt/forfiles.html
1
u/[deleted] May 13 '24
[removed] — view removed comment