Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: Examples of Safe File Handling

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

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?


returns the current directory


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


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


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.


  • 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