1.

Solve : Batch to rename multiple files...?

Answer»

I have a number of folders named USING a yyyymmdd format, i.e., 20100419. 

Inside each folder I have anywhere from 40 to 75 files and the individual file names are used in nearly every folder.

What I need is a batch file that will prepend the folder name (20100419) followed by a PERIOD to the front of every file name in each folder.

Can anyone HELP? Quote from: NyteOwl on April 19, 2010, 01:01:01 PM

I have a number of folders named using a yyyymmdd format, i.e., 20100419. 

What I need is a batch file that will prepend the folder name (20100419) followed by a period to the front of every file name in each folder.

dir /b  > oldname.txt
C:\20100419>type newname.bat
Code: [Select]echo off
set /p fold=%1
for /f  "delims=" %%i in (oldname.txt)  do (
copy %%i  %fold%%%i )
rem rename  %%i  %fold%%%i
rem del %%i )
C:\20100419>newname.bat  20100419
20100419
        1 file(s) copied.
        1 file(s) copied.
        1 file(s) copied.
        1 file(s) copied.
        1 file(s) copied.

C:\20100419>dir
 Volume in drive C has no label.
 Volume Serial Number is 0652-E41D

 Directory of C:\20100419

04/24/2010  04:32 PM              .
04/24/2010  04:32 PM              ..
04/24/2010  04:06 PM                 9 20100419file1.txt
04/24/2010  04:06 PM                 9 20100419file2.txt
04/24/2010  04:06 PM                 9 20100419file3.txt
04/24/2010  04:06 PM                 9 20100419file4.txt
04/24/2010  04:07 PM                 9 20100419file5.txt
04/24/2010  04:06 PM                 9 file1.txt
04/24/2010  04:06 PM                 9 file2.txt
04/24/2010  04:06 PM                 9 file3.txt
04/24/2010  04:06 PM                 9 file4.txt
04/24/2010  04:07 PM                 9 file5.txt
04/24/2010  04:31 PM               139 newname.bat
04/24/2010  04:29 PM                55 oldname.txt
              12 File(s)            284 bytes
               2 Dir(s)  300,677,402,624 bytes free

C:\20100419>1. Hi Greg!
2. I think you need to READ the question again.
Thanks for the responses, but I got the job done with an inexpensive app called Rename Maestro. 


Discussion

No Comment Found