Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.
Are your problems and questions related to your job?How much should the experts at Computer Hope charge for their answers?
From what I can tell, the dates at the end are not of standard length.
But if there is always only one space in the file name followed by the date then we could use the delims option to separate the file name.
We could, but I think it would be easier to just take off 7 characters, then test for a 1 and remove if found.
Test for a 1? Not understanding you there.
Sorry, that was a little vague. We would chop seven characters off the end, then since the only way it is 8 characters is if the month is 10, 11, or 12, they will all leave an extra "1" after chopping 7 off.
1. Are you wanting the date that is added to be a date you specify, or the date the program is ran?2. Are you wanting to copy the files into the specified folders, or move them in there? (I.e. delete them from the source)3. Please disregard the comment made by Candace. I too have posted work-related questions. I'm sure most people here have.
Also, if there are any date string at the end of the file name, it should be deleted.Many Thanks,Matilda
for /f "delims=" %%F in ('dir /s /b') do ( set OldFilePathAndName=%%~dpnxF set OldFileName=%%~nxF set FileName=%%~nF call :setfilename copy "!OldFilePathAndName!" "%NewFilePath%" >nul ren "%NewFilePath%\!OldFileName!" "!NewName!" echo !NewName!>>copylog.txt)goto :eof:setfilename:filepathloopecho !FileName! | find "\" >nulif errorlevel 1 goto :eofset FileName=!FileName:~0,-1!goto filepathloop