| View previous topic :: View next topic |
| Author |
Message |
sawang Newbie
Joined: 06 Mar 2005 Posts: 8
|
Posted: Sat Oct 22, 2005 1:28 am Post subject: Recursively delete directory... howto? |
|
|
| How do I recursively delete a directory the directory is not empty? |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Sat Oct 22, 2005 2:52 am Post subject: |
|
|
this is complicated as you will need to delete all the files in all the subdirectories, and then delete all the empty subdirectories before deleting the main directory ... this is messy stuff
you will need to use LIST FILELIST to list your subdirectories in a list, then go to each of these to delete all the files they contain
if your subdirectories themselves contain subdirectories, then it gets really messy
may be some one has written code for this that they will be happy to share with you or perhaps someone knows a nice shortcut through a DLL or API
serge _________________
|
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Sat Oct 22, 2005 2:59 am Post subject: |
|
|
In VD5 You can just use Directory Delete. It works that way for me. _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Sat Oct 22, 2005 3:38 am Post subject: |
|
|
hi chris,
i thought so too but the help file says
| Quote: | | DIRECTORY DELETE removes the directory named in <path>. The directory must be empty or it will not be removed. |
serge _________________
|
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Sat Oct 22, 2005 4:12 am Post subject: |
|
|
Well, don't know if it's a "bug" but it deletes all for me. I use it in one of my programs _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Sat Oct 22, 2005 8:30 am Post subject: |
|
|
cool chris, you would know better given that you use it
serge _________________
|
|
| Back to top |
|
 |
MarkTrubo Contributor


Joined: 27 May 2001 Posts: 148 Location: Long Island, NY
|
Posted: Sun Oct 23, 2005 11:16 am Post subject: |
|
|
| I call an old / dangerous dos program called "zap.exe". Recursive / non-empty deleting always scares me, but sometimes you need it! |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Sun Oct 23, 2005 5:55 pm Post subject: |
|
|
For Windows 98 and below you can also call the DELTREE command. I'm
not sure if that will work on the newer Windows OSs. _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
|