I've made a batch file that deletes everything inside of the temp folder. However, it deletes everything except the folders that are in the temp folder. Here is the code that I have right now:
del "C:\Documents and Settings\Administrator\Local Settings\Temp\*.*"
Any suggestions as to what I can do to make it so that my batch file will delete all the files and folders inside the temp folder.
Also is there anything I can do so that it doesn't just delete the files and folders inside the temp folder but also deletes the files and folders inside the temp folder on ALL other user accounts?
Thanks in advance for any help given.
Making a batch file to delete folders?
Page 1 of 13 Replies - 3240 Views - Last Post: 20 April 2010 - 08:58 PM
Replies To: Making a batch file to delete folders?
#2
Re: Making a batch file to delete folders?
Posted 20 April 2010 - 08:33 PM
the command to remove a directory is rmdir
or if you are really gutsy, you can do something like this :
or if you are really gutsy, you can do something like this :
cd "C:\Documents and Settings\Administrator\Local Settings\Temp" del * /s /q
#3
Re: Making a batch file to delete folders?
Posted 20 April 2010 - 08:51 PM
I know cd lets the batch file go to that particular folder but what does the * /s /q do? I tried looking it up and couldn't find much. Most of what I found on batch file commands just had simple stuff like rem, echo, del, etc. So if anyone knows of a good website with commands for batch file I'd really appreciate it. Also when I run the changes you made it still leaves the folders.
#4
Re: Making a batch file to delete folders?
Posted 20 April 2010 - 08:58 PM
I use a single asterisk because this will delete both all files & all directories. You can validate this by issuing dir * & you'll see only directories.
The switch s says to delete through all sub directories. So everything under the current directory will be trashed.
The switch q says to be quiet, otherwise you get prompted to confirm for each directory that it tries to delete.
The switch s says to delete through all sub directories. So everything under the current directory will be trashed.
The switch q says to be quiet, otherwise you get prompted to confirm for each directory that it tries to delete.
Page 1 of 1

New Topic/Question
This topic is locked



MultiQuote


|