Okay so I am trying to make a simple BAT file that deletes files in multiple folders. Now this is what I have so far. I would like it so it deletes all files and folders in the Temp directory but not folders in the data directory... I would also like it to say yes to the prompts. How do I do this???
@ECHO OFF
DEL "C:\ProgramData\TVersity\Media Server\data\*.*"
DEL "%LOCALAPPDATA%\Temp\*.*"
I am planning on adding in more directories into this BAT file so please if you can respond with "how to commands"... Because I would like to know how to specify whether to delete all folders and files or just files.
Also how to automate the "yes" to all prompts.
del /s /q c:\somedirectory\*.*
should take care of deleting all files recursively without deleting the directories, in "quiet" mode, which doesn't give you the prompt.
To delete an entire directory and all of its files and subdirectories, you can use rd with the same flags:
rd /s /q c:\somedirectory
http://technet.microsoft.com/en-us/library/cc771049.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With