Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I have a requirement to rename all the files present in the folder by appending date to actual file name and move it to archive folder.
Can any one help me in achiving the functonality by using exe command.
Many thanks in advance!
Deepak
Try this,
Let vSource = 'C:\Users\XXX\Desktop\ABC Dashboard\01SourceFile;
Let vArchive = 'C:\Users\XXX\Desktop\ABC Dashboard\01SourceFile\Archive';
For Each vFile in FileList('$(vSource)\*.*')
Let vNewFile = Replace(Subfield('$(vFile)','\','-1'),'.' & Subfield('$(vFile)','.','-1'), Date(Today(),'YYYYMMDD') & '.' & Subfield('$(vFile)','.','-1'));
EXECUTE cmd.exe /c Ren "$(vFile)" "$(vNewFile)";
NEXT;
EXECUTE cmd.exe /c Move /Y "$(vSource)\*" "$(vArchive)";
You can use this command
cd /home/webapps/project1/folder1
for f in *.csv
do
cp -v "$f" /home/webapps/project1/folder2/"${f%.csv}"$(date +%m%d%y).csv
done
Hi
Thanks for your reply.
I am trying below for moving files, dont know how to rename and then move.
FOR each vFile in filelist('C:\Users\XXX\Desktop\ABC Dashboard\01SourceFile\*')
LET File = 'C:\Users\XXX\Desktop\ABC Dashboard\01SourceFile\*';
Let AFile = 'C:\Users\XXX\Desktop\ABC Dashboard\01SourceFile\Archive\';
Execute cmd.exe /C move /Y "$(File)" "$(AFile)";
NEXT
Try this,
Let vSource = 'C:\Users\XXX\Desktop\ABC Dashboard\01SourceFile;
Let vArchive = 'C:\Users\XXX\Desktop\ABC Dashboard\01SourceFile\Archive';
For Each vFile in FileList('$(vSource)\*.*')
Let vNewFile = Replace(Subfield('$(vFile)','\','-1'),'.' & Subfield('$(vFile)','.','-1'), Date(Today(),'YYYYMMDD') & '.' & Subfield('$(vFile)','.','-1'));
EXECUTE cmd.exe /c Ren "$(vFile)" "$(vNewFile)";
NEXT;
EXECUTE cmd.exe /c Move /Y "$(vSource)\*" "$(vArchive)";