From: jihane on
Hello all

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["..."]?

Thank you in advance for your help

From: Bill Rowe on
On 3/5/10 at 4:31 AM, jihane.ajaja(a)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.


From: Christoph Lhotka on
hi,

as far as I understand a combination of

ToFileName[{NotebookDirectory[], dir}, fln]

where dir is directoryname and fln is a file name while create
any filepath you need in Save, Export, Put, etc...

(define a suitable function)

Christoph


On Fr, 5.03.2010, 10:31, jihane wrote:
> Hello all
>
> 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["..."]?
>
> Thank you in advance for your help
>
>
>


--
Mag. Christoph Lhotka
University of Vienna / Institute for Astronomy
Tuerkenschanzstrasse 17, A-1180 Vienna, Austria
fon. +43 (1) 4277 51841
mail. lhotka(a)astro.univie.ac.at


From: dh on
Hi,
simply specify the whole path of the file in Export.
Daniel

On 05.03.2010 10:31, jihane wrote:
> Hello all
>
> 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["..."]?
>
> Thank you in advance for your help
>


--

Daniel Huber
Metrohm Ltd.
Oberdorfstr. 68
CH-9100 Herisau
Tel. +41 71 353 8585, Fax +41 71 353 8907
E-Mail:<mailto:dh(a)metrohm.com>
Internet:<http://www.metrohm.com>