MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: EXPORT TO DIFFERENT FOLDERS

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108048] Re: EXPORT TO DIFFERENT FOLDERS
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sun, 7 Mar 2010 04:04:24 -0500 (EST)

On 3/5/10 at 4:31 AM, jihane.ajaja at mail.mcgill.ca (jihane) wrote:

>I am currently exporting different files to the folder set by
>SetDirectory["..."]. I have a loop that produces 5 files at a time
>and then start again and produce 5 other files. How could I ask the
>program to put each of these 5 files in a specific folder I created
>in the main folder ; the one set by SetDirectory["..."]?

Do the folders exist at the time you write the files or do they
need to be created?

If they exist, you could either use SetDirectory to change the
working directory as needed, write the files then use
ResetDirectory to restore the working directory back to the main
folder or use ToFileName[foldername, filename] to specify both
the folder and filename when writing data to files.

That is

Export[ToFileName[foldername, filename], data, format]

writes data to filename located in foldername located in the
current working directory, i.e., the directory (folder) returned
by Directory[].

If the folders don't exist, use CreateDirectory to create them
then write data out as suggested above.



  • Prev by Date: Re: Transition to Wolfram Workbench
  • Next by Date: Possible bug in Table and/or lists (Mathematica v.7)
  • Previous by thread: Re: EXPORT TO DIFFERENT FOLDERS
  • Next by thread: Re: EXPORT TO DIFFERENT FOLDERS