Friends,
I need a batch script with the following:
- I have list of file say a.txt, b.txt, c.txt,d.txt and so on
- First it should create folder based on file name, like a,b,c,d and so on.
- Second, copy the files to respective folder, a.txt to folder a, b.txt to folder b and so on.
- Finally, all the files, in the respective folder, the file name should change to apple.txt. a.txt in folder a should rename to apple.txt, b.txt in folder b also rename to apple.txt. and so on.
Is that possible in batch script?
if so could someone pls help
batch script to create folder and rename file
Moderator: DosItHelp
Re: batch script to create folder and rename file
Untested: try it on some sample files.
Code: Select all
@echo off
for /f "delims=" %%a in ('dir *.txt /b') do (
md "%%~na" 2>nul
copy /b "%%a" "%%~na\apple.txt"
)