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

Sub-directory+ 2

Status
Not open for further replies.

FreddyHo

IS-IT--Management
Jul 2, 2001
20
HK
Hello there!

I'm using VFP6 and having a problem to identify names of all sub-directories in order to erase them. This is because I can't remove it by using command "RD" unless I know exactly the names of sub-directories.

Thanks in advance!
 
or you could use GETDIR() function to select the directory. but then the selected directory should first be emptied prior to deletion. and DOS's DELTREE is a very good alternative like Sir Mike said.

other directory utilities:
faq184-1821
faq184-1760

kilroy [trooper]
 
Thanks Mike, Kilroy and Chris.

Chris is right. I'm using Win2K and deltree just doesn't work.

Chris, one more question : Is "C:\my old folders" supposed to be the name of parent folder of all sub-directories?

Thanks again!
 
I believe neither Win2K or XP support deltree.

No, but NT2K does support RD with the /S switch. I'm sure XP acts the same way but I don't currently have access to an XP box to test it on:
Code:
RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path
  /S      Removes all directories and files in the specified directory
          in addition to the directory itself.  Used to remove a directory
          tree.
  /Q      Quiet mode, do not ask if ok to remove a directory tree with /S



-Dave S.-
[cheers]
Even more Fox stuff at:
 
I'm surprised no one has mentioned using ADIR(aFolders,"","D") on this thread. The only catch is you'd have to loop through the resulting array and drill down into each directory with an addition ADIR command.



-BP
 
Chris,

Reread my post:
/S Removes all directories and files in the specified directory
in addition to the directory itself. Used to remove a directory
tree.


I took the text from a command window within NT2K.


-Dave S.-
[cheers]
Even more Fox stuff at:
 
Chris,

Sorry if I sounded like 'Yeah-huh' or something but I just wanted to let folks know that it would work.
I think it's cool that the some OS's can do that now. As most of us probably know, RD for a long time would only work if the directory was empty. Including sub-dirs. It was nice when deltree came around.


-Dave S.-
[cheers]
Even more Fox stuff at:
 
Dave

No offence taken - I was prejudiced by

'As most of us probably know, RD for a long time would only work if the directory was empty.'

and so didn't take into account what followed.

Why don't you write it up as FAQ?

One can't assume the existence of WSH on a user's machine so this is a 'safer' option. [smile]



FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
And see that's the kicker. Chances are, if you're running an OS that you can use RD /s on, WSH is probably already installed. As far as I know, RD /s only works on NT+, but WSH is built in to '98+. However, there may be some features in newer versions of WSH that aren't in versions installed in earlier OS's.

It's a dilemma.

I still may write an FAQ though. Good suggestion.



-Dave S.-
[cheers]
Even more Fox stuff at:
 
I have often used DELTREE to remove nested folders and files on a Windows 2000 server. I was sitting at a Windows Millennium workstation, of course. Since the functionality is now incorporated into "RD /S", this is a case where Microsoft is trying to move away from that command (by dropping it) rather than say it can't be done anymore. -- dbMark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top