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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DIR/FILE Functions

Status
Not open for further replies.

NW

Programmer
Feb 3, 2000
61
GB
How can I check a directory to see whether it exists?<br>If exists, how can I delete all files & sub folders under that directory?.<br>Please help!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
To check , if you have already put a DirList , you can sent it : Dir1.Path=&quot;c:\YourPath&quot; & if it doesn't exist it will generated an error<br><br><A HREF="mailto:dorne38@mageos.com">dorne38@mageos.com</A><br>
 
VB5.00 given't you a function for deleting all files in a directory.<br>You must delete all file in the directory with the instruction Kill &quot;FileName&quot; & only after you can delete the diretory with RmDir &quot;Directory&quot;.<br>Remark : if you use RmDir without kill all files it occur an error<br><br>Remark ... Please sent me at <A HREF="mailto:drone38@mageos.com">drone38@mageos.com</A>
 
I use Dir(<i>DirectoryName</i>, vbDirectory). If the directory exists it returns a string. <p>Colin Chevrier<br><a href=mailto:colin.chevrier@ca.jdsunph.com>colin.chevrier@ca.jdsunph.com</a><br><a href= > </a><br>
 
NW,<br><br>If you really want to remove everything, you could invoke the DOS DELTREE command via the VB shell function. The catches are that:<br>under Win 95 / 98 you have to know the 8-character DOS name of the folder.<br>I'm not sure if this works at all in Win NT / 2000.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top