I have file that is a list of videos files that i have to move from on folder to another every day, but the list has leading zeros on the name. Here what i have so far:
Result.txt - this is file that has my list in
00005215040
00014474158
00014474176
00014474157
00000963066
File mover.bat@echo off
for /F "tokens=*" %%a in (Result.txt) do (
if exist "c:\input\%%a.mpg" copy "c:\input\%%a.mpg" "c:\output\%%a.mpg"
)
pause
but that when i run in to a issue my files don't have the leading zeros in there file name.thank for any help.
@echo off setlocal EnableDelayedExpansion for /F "tokens=*" %%a in (Result.txt) do ( set row=%%a set num= for /L %%j in (0 1 10) do ( if "!row:~%%j,1!" neq "0" if not defined num set num=!row:~%%j! ) if exist "C:\input\!num!.mpg" copy "C:\input\!num!.mpg" "C:\output" > nul ) pause
Please, try to post in a more correct English since what you wish looks quite confusing.
| « exception error in main | [Solved] Text files read in direct... » |