Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: How to check if a file exists?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47557] Re: How to check if a file exists?
  • From: Marcus Stollsteimer <marcus314 at yahoo.com>
  • Date: Fri, 16 Apr 2004 05:20:22 -0400 (EDT)
  • References: <c5lf22$bn0$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Thomas Guignard wrote:
> I just can't find the function to check the existence of a file!

Hi,

you could use FileType[]:

- FileType["file"] gives the type of a file, typically File, Directory
or None.
- FileType returns None if the file specified does not exist.

you can define the following functions for testing
if name is a file/directory:

  FileQ[name_String]:=FileType[name]===File
  DirectoryQ[name_String]:=FileType[name]===Directory

Regards,
Marcus

-- 
God knows. Or guesses. -- John Irving


  • Prev by Date: Re: When Is Precision[ ] $MachinePrecision, And When Is It Not?
  • Next by Date: Unexpected Result for InputForm
  • Previous by thread: Re: How to check if a file exists?
  • Next by thread: Re: How to check if a file exists?