red_white
asked on
Help to copy file and rename source file
Hi All
I have to copy file from c:\ to d:\ and after copy rename source file (or stamp with current date)
OS: Windows XP/Vista/Windows 7/Windows 2003
Thanks
I have to copy file from c:\ to d:\ and after copy rename source file (or stamp with current date)
OS: Windows XP/Vista/Windows 7/Windows 2003
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hola este script te permite pasar como parametro una fecha de esta manera puedes renombrar los ficheros de origen.
try it
http://www.robvanderwoude.com/datetimentexamples.php
saludos
try it
http://www.robvanderwoude.com/datetimentexamples.php
saludos
hi this script as a parameter lets you pass a date in this way you can rename the source files.
try it
Check following batch script if this works for you!
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
FOR /F "tokens=*" %%I IN ('DIR C:\DATA\*.* /B') DO (
SET MM=%DATE:~4,2%
SET DD=%DATE:~7,2%
SET YYYY=%DATE:~10,4%
ECHO Coping %%I
COPY "%%I" "D:\DATA\%%~nI_!MM!_!DD!_!YYYY!%%~xI">NUL)
ASKER
I found way to rename file with current date
ren *.log %date:~-10,2%%date:~-7,2%% date:~-2,2 %.log
but will be better to add date to source file.
Regards to all
ren *.log %date:~-10,2%%date:~-7,2%%
but will be better to add date to source file.
Regards to all
ASKER
Hi Farhankazi
This batch scrip add date to name.file on destination. I need script after copy file from c:\ to d:\ to add date to file on c:\
regards
This batch scrip add date to name.file on destination. I need script after copy file from c:\ to d:\ to add date to file on c:\
regards
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Farhankazi
Thanks, that was what I need.
Any site to learn more about batch script?
Regards
Thanks, that was what I need.
Any site to learn more about batch script?
Regards
Here are some useful links for learning and reference on batch scripts.
http://commandwindows.com/index.html
http://www.paulslore.com/index.php?option=com_content&task=view&id=13&Itemid=30
http://www.robvanderwoude.com/batchfiles.php
http://ss64.com/nt/
http://www.dostips.com/
http://www.ericphelps.com/batch/
~bp
http://commandwindows.com/index.html
http://www.paulslore.com/index.php?option=com_content&task=view&id=13&Itemid=30
http://www.robvanderwoude.com/batchfiles.php
http://ss64.com/nt/
http://www.dostips.com/
http://www.ericphelps.com/batch/
~bp
ASKER
How can I add curent datum to source file after copy file to destination folder.