Hi,
I need to see if a particular directory is present or not, at the specified path.
For a file we can do it using fopen() return value but what for a directory (for all platforms)?
--Virendra--
Printable View
Hi,
I need to see if a particular directory is present or not, at the specified path.
For a file we can do it using fopen() return value but what for a directory (for all platforms)?
--Virendra--
What language are you doing this in...PHP? If so, you can use file_exists. It checks for files or directories.
PeejAvery,
I am doing this through C++. Here, I want to know if the directory already exists, before calling CreateDirectory() API.
Thanks,
--Virendra--
Use CreateFile with dwDesiredAccess==0 and dwCreationDistribution==OPEN_EXISTING.
CreateFile can be used to "open directories".
It should fail if the directory doesn't exist.
Ya, this one is better solution.
Thanks a lot........
Then this belongs in the C++ forum. I would have never been confused if it had been there to start. Glad your problem was solved. :wave:Quote:
Originally Posted by vnyelurkar
[ Moved Thread ]
Look at ::PathIsDirectory(). ;)
Cheers
The easier one: GetFileAttributes() == FILE_ATTRIBUTE_DIRECTORY.