Rename with Batch File

G

Guest

I would like to be able with a schedualed batch file to move and rename a file.

The File comes in as FLT001.flt and I would like to move the file to a
different folder and add current date and time to the file name, is this
possiable?

Thanks............. Alastair.
 
P

Pegasus \(MVP\)

Alastair79 said:
I would like to be able with a schedualed batch file to move and rename a file.

The File comes in as FLT001.flt and I would like to move the file to a
different folder and add current date and time to the file name, is this
possiable?

Thanks............. Alastair.

You could try this batch file:
Line1 @echo off
Line2 set D=%date:~4,10%
Line3 set D=%D:/=-%
Line4 set T=%time:~0,5%
Line5 set T=%T::=.%
Line6 set NewName=FLT001 %D% %T%.flt
Line7 echo ren FLT001.flt "%NewName%"
Line8 echo move "%NewName%" "c:\New Folder"

You may need to adjust the numbers in Line2 and in
Line4 to suit your time zone and preferences. When
finished, remove the "echo" commands in Line7 and
in Line8 to activate the batch file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top