BookmarkSubscribe
Choose Language Hide Translation Bar
conroyco
Community Trekker

Saving files to created folder

I am trying to save a journal and pdf to a folder after they are created.

 

First I use pick directory to get the files I want to analyze. When this is done, the files are saving into that directory.

 

However, I want them to save into a folder with the date.

 

This is the code I have tried:

 

Main Menu( "Minimize All" );
path = Pick Directory( "Select a directory" );
Set Default Directory( path );
files = Files In Directory( path );
output = Create Directory( path || Substitute( MDYHMS( Today() ), "/", "-", ":", "." ) || "/" );
 
It then goes into a for loop to create the graphs
At the end of the for loop you have
jrn <<
SaveJournal( path || files[i] || ".jrn" );
Current Journal() << close window();

report << SavePDF( path || files[i] || ".pdf" );
report << close window();
dt << close window;
org << close window; 

For the saved parts, Ive tried path || output|| ... and I've also tried add "/" - none of these seem to work.

 

For now its saving into the directory as far as path, but I want it to go one step further into output

 

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
jerry_cooper
Staff (Retired)

Re: Saving files to created folder

I think the issue may be that the assignment of your "output" variable is not producing the result you're expecting. Try this:
output = path||substitute(MDYHMs(Today()), "/", "-", ":", ".")||"/";
Create Directory ( output );

Then, when you go to save your report, the following should work for you:
report << SavePDF ( output || files[i] || ".pdf");

View solution in original post

0 Kudos
2 REPLIES 2
jerry_cooper
Staff (Retired)

Re: Saving files to created folder

I think the issue may be that the assignment of your "output" variable is not producing the result you're expecting. Try this:
output = path||substitute(MDYHMs(Today()), "/", "-", ":", ".")||"/";
Create Directory ( output );

Then, when you go to save your report, the following should work for you:
report << SavePDF ( output || files[i] || ".pdf");

View solution in original post

0 Kudos
conroyco
Community Trekker

Re: Saving files to created folder

Great, just tried it there and it worked !



Thank you






0 Kudos