|I am trying to move files by filename into an organized folder structure by year. The file names begin with the year and are followed by an auto incrementing number. i.e. 201000001.tif, 201000002.tif. I would like to have a batch script that moves the files to \\server\share\year, with the year being defined in the first four characters of the filename.|
If I had a delimiter after the year, I could write it as follows:
For /F "tokens=1 Delims=_" %%A in ('dir /b /a-d *.tif') Do (
IF not Exist \\Server\Share\%%A MD \\Server\Share\%%A
Move /Y %%A*.tif \\Server\Share\%%A
I don't know how to write it without the delimiter. Thank you for your help.