MathGroup Archive 2002

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

Search the Archive

Re: Examples of Safe File Handling

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36954] Re: [mg36938] Examples of Safe File Handling
  • From: "Y.A.Tesiram" <yas at pcomm.hfi.unimelb.edu.au>
  • Date: Thu, 3 Oct 2002 00:16:36 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On Wed, 2 Oct 2002, Steven wrote:

> I've been looking over the file and directory manipulation functions in Mathematica
> 4.1, and I'm not finding good examples of how to test for the existence of
> a file or directory before I attempt to create, access, or delete it.  Are
> there any good examples of this somewhere?
>
> STH
>
>
Steven,

Directory[]

returns the current directory

$Path

returns the directories in your path where files can be found.

SetDirectory[]

changes to the specified directory and makes it the current directory.

FileNames[]

returns a list of all the file names (text documents, picture documents
etc) and subdirectory (folder) names in the current directory.

Since FileNames returns a list of elements, you can use all sorts of tests
to see if a file you're looking for is in a said directory or not or
whether it is a subdirectory or not.

I hope that this will get you started.


Regards
Yas




  • Prev by Date: Re: Re: Linux Users?
  • Next by Date: Re: Sum of 1/Primes
  • Previous by thread: Re: Examples of Safe File Handling
  • Next by thread: Sum of 1/Primes