I am trying to create a batch file that allows me to transfer files with a FILENAME containing specific numbers. I have thousands of files that have filename in a certain format - with dates at the end (i.e. abc010118.txt
) - that I would like to archive.
*Note: the files were created/last modified on the same date, and hence the filename is the only thing that can be used to differentiate one another
Having never studied programming, I searched and tried different things for hours to come up to writing this cmd:
for /f "tokens=*" %a in ('dir C:\Users\abc\Desktop\test\*122718. /ad /b') do robocopy "C:\Users\abc\Desktop\test\%a" "C:\Users\abc\Desktop\dest\%a" /e /v /np /w:1 /r:1 /xo
What I would like to add to my command is to repeat the same action as the one that my command is performing, but with an increment of 100. For example, I would like the files containing the string 010118
at the end to move to another directory and then move files with their name containing the string 010218
to move to another directory and so on.
I would really appreciate any feedback and suggestions on this. Please know that I am completely new to programming and would really appreciate if anyone could give a detailed explanation of each line.