Techwarelabs Community

Techwarelabs Community (https://www.techwarelabs.com/community/index.php)
-   Software - Applications, Programming, and Games (https://www.techwarelabs.com/community/forumdisplay.php?f=13)
-   -   Batch File Help (https://www.techwarelabs.com/community/showthread.php?t=13052)

agita 08-08-2007 02:14 PM

Batch File Help
 
Hello this is my first post, don't want to irritate so i'll jump to the point.

I'm looking for some help with creating a batch file.

I want to delete multiple files, but just to keep it simple i will say one.

If i want to delete my temp files from the temp folder in windows ie.

C:\WINDOWS\Temp\

How do I delete everything in the folder but not the folder itself?


EDIT:

Answered my own question

del /s C:\WINDOWS\Temp\*

I kept deleting the entire folder lol.

Omega 09-03-2007 04:21 PM

Yup. Alternatively, if you wanted a more 'scripty' way to accomplish it, you could:
Code:

for %i in (c:\WINDOWS\Temp\*) do del %i
As a side note, I like to test scripts like this prior to actually running them, by doing something along the lines of:
Code:

for %i in (c:\WINDOWS\Temp\*) do echo %i


All times are GMT -5. The time now is 03:15 AM.

Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.