i am making a batch script which i want to copy file names with but i want them (file names) to be like this file1-hi.jpg file2-hello.jpg i am able to copy file name to a txt file but i cant find a way to put file1 with the number incrementing each time a file name is written
these are the codes that i have
dir /b > filenames.txt
for %%a in (*.jpg) do echo %%~na >> Tem.txt
type textfile.txt >> tem.txt
copy tem.txt textfile.txt
del tem.txt
CodePudding user response:
Not really sure what you actually want to do, but here's a start:
FOR /f "tokens=1*delims=:" %%b IN ('dir /b /a-d "%sourcedir%\*" ^|findstr /n /V ":"') DO ECHO file %%b %%c