PDA

View Full Version : Folder.Create using variable are part of name


GalacTekM
09-19-2008, 01:40 PM
I'm trying to create a folder using a variable for part of the name. I want to create a folder in the source folder named DBU_(the current date) and have been unsuccessfull. This is what i have so far:

date = System.GetDate(DATE_FMT_US);
Folder.Create("%SourceFolder%:\\DBU_"..date.."");

Once the folder is created, i want to copy files from the source directory into the created folder but im not sure how to tackle that task. Any help would be appreciated. Thanks

Worm
09-19-2008, 01:46 PM
DATE_FMT_US has backslashes "/" in it which are unsupported in a folder name


You either need to replace them with a dash "-", or use DATE_FMT_ISO

GalacTekM
09-19-2008, 02:21 PM
i changed the DATE_FMT_US to DATE_FTM_ISO but it is still not creating the folder.

Worm
09-19-2008, 02:32 PM
date = System.GetDate(DATE_FMT_ISO)
Folder.Create(SessionVar.Expand("%SourceFolder%") .."\\DBU_"..date);

GalacTekM
09-19-2008, 02:36 PM
Works great! Thanks alot.

As for my second question, if i wanted to copy files into the created folder, what would be my destination?

Worm
09-19-2008, 02:39 PM
date = System.GetDate(DATE_FMT_ISO)
sDestinationFolder = SessionVar.Expand("%SourceFolder%") .."\\DBU_"..date;
Folder.Create(sDestinationFolder);

GalacTekM
09-19-2008, 02:40 PM
Thanks again, i'm slowly learning.