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

AT command and bat files

Status
Not open for further replies.

GregBVH

IS-IT--Management
Oct 5, 2000
19
US
I created a *.bat file to perform a delete once a month of tempory directories on the network.

My problem is I cant find a way to delete all the subdirectories of a directory without deleting that directory its self.

What I have is a directory on the server that has each of the users innitals in it that they can use for temp space. That directory on the server is shared and maped to a drive letter for users, so i cant delete that main directory on the server. What I want to do is delete all of the sub directories of it (the users initials) so I can copy in a fresh set of empty folders with the correct permisions.

The copy is not a problem. Doing a del /s /q only gets all files in all the directories but leaves those directories and any sub directories that were made. RD /s would do it if I picked the main directory but that is whats shared so I cant delete that without destroying the share and it needing to be remade.

Please help, any suggestions?
 
The del command won't do. What you need to use is NT's "RD"...or "Remove Directory".
Depending on your paths, etc..try this to see how it works:
Try this:

Create a new folder called "Deltest" and then create within that folder a subfolder called "Test". Now copy some files in the "Test" subfolder. Now go to the command prompt and type:

RD "c:\Deltest\Test" /s

and press Enter to delete the folders and the files contained within them.

That'll do what you want - Good Luck!

 
That would work, but I want to leave the folders where they currently are, which is only one directory deep on the server.

I gues the problem with deleting the folder that everything I want deleted is inside of, is that that folder is shared and if I delete it then I have to remake the share so I can't use an AT command to automate the clean while I am not here.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top