Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to remove an existing directory programatically?
Message
 
To
15/10/2002 22:22:52
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00711569
Message ID:
00712645
Views:
17
>Hi all:
>
>I am attempting to first, delete an existing directory and all subfolders within that directory and then create a new directory with subdirectories where needed.
>
>I have tried the RMDIR and RD commands - but get a message that says "File Access is Denied". Clicking HELP tells me that I am trying to write to a protected file (whihc is not true).
>
>Any suggestions? Thank you in advance.

Hi Henry.
You cannot RMDIR a directory if it contains files and/or directory.
You must build a recursive function which:
- receives a path
- deletes all files: delete file (cPath+"\*.*")
- gets a list of subdirectories (ADIR)
- for each subdirectory (if any) call self
- finally RMDIR (cPath)

Hope this helps and bye.
Jose.
------------------
Jose Marcenaro
Tercer Planeta - Argentina
http://www.tercerplaneta.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform