Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello,
I’m trying to make a bat file that will delete all files in the My Pictures and the My Music folders for a particular user. This should work for both WinXP and Win2000Pro machines.See, we have a public computer lab in our library and all of people using these public computers use the same user name, which is: “All”.
What I want is to do is to delete any file saved in the My Pictures and My Music folders regardless of what time, date, or type file they are. I want to completely empty the folders for that user.
The path to the folders are:
C:\Documents and Settings\All\My Documents\My Pictures\C:\Documents and Settings\All\My Documents\My Music\
After I have the batch file created I will then copy it to the PCs and have it run as a scheduled task daily. That way, keep the folder clean of their leftovers.
Any help will be appreciated, Thank You!
FrankieSo far this is what I have:
@ECHO OFF
REM
REM Deletes any file in the specified folders
REM
REM This is for this Local Computer Only
REM
CLS
:BEGINdel C:\Documents and Settings\all\My Documents\My Pictures\*.* /S
REM
del C:\Documents and Settings\all\My Documents\My Music\*.* /SREM
REM End of this file
REM:END
EXITWho knows, knows and who doesn't know, dosen't know jack!
El que sabe, sabe y el que no sabe, no sabe nada!

As much as I dislike it when people ignore the scripting question asked, I must say there are better options available.
@DEL /S /Q /F "C:\Documents and Settings\all\My Documents\My Music\*.*"
@DEL /S /Q /F "C:\Documents and Settings\all\My Documents\My Pictures\*.*"

Razor2.3 Thank You for your help. I will try it and post back.
FrankieWho knows, knows and who doesn't know, dosen't know jack!
El que sabe, sabe y el que no sabe, no sabe nada!

Razor,
I tested it on one computer and it worked perfectly. Thank You very much.Next, I put the batch file on the server and added it as a scheduled task on on all Public Computer Lab PCs to run at Daily at the end of the day.
Who knows, knows and who doesn't know, dosen't know jack!
El que sabe, sabe y el que no sabe, no sabe nada!

I fail to see what the use is of deleting all the files in My Pictures and My Music folders. There is nothing stopping people adding music and pictures in folders with different names, and the above batch file won't touch those. That's why Razor's suggestion of using Windows SteadyState is better.

![]() |
Batch file: Nested IF not...
|
size of int vs. pointer
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |