xcopy with file rename with appedning code prefix wid filena

April 13, 2012 at 01:14:22
Specs: winxp and above
eg. my filename is 20120412.CSV i want to append code like 416 with existing file name like
416_20120412.CSV.

i want to do with xcopy command.
xcopy c:\*.csv to \\servername\folder\416_*.csv


See More: xcopy with file rename with appedning code prefix wid filena

Report •


#1
April 13, 2012 at 03:11:57
@echo off
pushd Your Directory
for %%j in (*.csv) do xcopy "%%j" "\\servername\folder\416_%%~nj.csv"
popd

Report •

#2
April 23, 2012 at 00:14:39
Thanks a lot ..in the same can i create a log fie

Report •

#3
April 23, 2012 at 04:24:11
@echo off
pushd Your Directory
for %%j in (*.csv) do xcopy "%%j" "\\servername\folder\416_%%~nj.csv" >>logfile.txt
popd

Tony


Report •

Related Solutions

#4
May 9, 2012 at 03:23:10
Thanks for your help but i got this message for every file for transfer
Does Z:\416_20120506.csv specify a file name
or directory name on the target
(F = file, D = directory)? 

Report •

Ask Question