How to create Directory with date automatically in Amibroker

Hello Everyone
Can any one help me to create a afl which will create folder in my C drive automatically according to date.

I have coded the below code but it is not working..

fmkdir( "C:\\Data Collection" );
fmkdir( "C:\\Data Collection"+DateTimeToStr(LastValue(DateTime()), 2) ); 

I need folder to be created evey day When i run the code. I need this for Daily reporting..


I guess, you mean to create subfolders within "Data Collection".
Note: I used DateTimeFormat instead of DateTimeToStr.

dtVal = LastValue(DateTime());
dtStr = DateTimeFormat("%Y%m%d", dtVal);

path = "C:\\Data Collection\\";// main directory
subfolder = path+dtStr;// subfolder


Note: When creating File/Folder names read about allowed characters here.


Thanks ..Excellent.
It is working as needed...
You are always helpful for me...
Thanks Once again...