Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Identifying if directories or documents exist 1

Status
Not open for further replies.

Domino2

Technical User
Jun 8, 2008
475
GB
I am running through a table recordset which holds a record of directories and sub directories on a drive, and wordfiles existing in them. My first problem is idenifying whether a directory or subdirectory still exists on a pc. I am using the syntax below. However if rst("SDIDOC")equals c:\Test, then i need to add a "\" at the end for the code to work, but my problem is it only seems to veryfy the directory existing if their is a file in it. If the directory is empty, but does exist, then my code thinks it's not there. Why? Thanks


strFullName = rst("SD1DOC")
If Dir(strFullName) = "" Then
 
If it's a directory, you could use this test:[tt]

if dir(strFullName, vbDirectory) <> "" Then
[/tt]
BTW - I think Dir("c:\somefoldername") tests for a file named "somefoldername" in the parent directory (c:), while Dir("c:\somefoldername\") tests for files within a directory called "somefoldername" (to try to answer the question from the top of my head)

Roy-Vidar
 
Thanks Roy. Have you ever thought of doing predictions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top