PDA

View Full Version : Get systemdate into a filename


Guy Danneels
08-07-2007, 07:44 AM
Hello,
(sorry for my bad English)
I'm learning to use AMS 6.0 for some time and want to thank all you great guys; I've learned a lot from you all. Thanks!!
But now I have a problem and I've not found any example on the Forum... looking for some days now...
I need to copy the user files to an other place, and put the systemdate into the filename.
My code:
dag = System.GetDate(5);
maand = System.GetDate(4);
jaar = System.GetDate(6);

datum = ("..dag.., ..maand.., ..jaar..");
newname = ("datum".."Filename.txt");

File.Copy ("C:\\PHAISTOS\\Filename.txt", "C:\\PHAISTOS\\BACKUP\\..newname");
But I can't get it done... what do I wrong?

What I would like to have as a result is:
C:\\PHAISTOS\\BACKUP\\28-04-2007_Filename.txt

Please can I get some help?

bule
08-07-2007, 08:50 AM
newname = (datum.."_Filename.txt");

Guy Danneels
08-07-2007, 09:10 AM
Thanks Bule for quick responce... but it's not resulting in changing the filename "Filename.txt" into "07-08-2007_Filename.txt"
Could you help me out a bit more?
Thanks

macko
08-07-2007, 09:40 AM
datum = dag.."-"..maand.."-"..jaar

Guy Danneels
08-07-2007, 09:46 AM
Hello Macko,

problem remains...
File.Copy "C:\\PHAISTOS\\Filename.txt", "C:\\PHAISTOS\\BACKUP\\..newname");
It results in "..newname" as a filename, instead of "07-08-2007_Filename.txt"

macko
08-07-2007, 10:04 AM
change
File.Copy "C:\\PHAISTOS\\Filename.txt", "C:\\PHAISTOS\\BACKUP\\..newname");

to this
File.Copy "C:\\PHAISTOS\\Filename.txt", "C:\\PHAISTOS\\BACKUP\\"..newname);

never include a variable in the " " since it will be read as is and not as a variable.:D

Guy Danneels
08-07-2007, 10:18 AM
Thanks Macko,
It works fine now.
And I have learned again.

macko
08-07-2007, 10:20 AM
i did learned that to the experts of ams and share it to others