Anyone know if any type of program, batch file or script that would do this?

Nocturnal

Lifer
Jan 8, 2002
18,927
0
76
Does anyone know of any type of script, batch file or program that will go into the C:\Documents and Settings directory and into each user account and then go to C:\Documents and Settings\User\Local Settings and then delete all folders except for Application Data.
This is mainly to help with doing data backups for clients. The Temp and TIF is filled with junks that is never needed for data backup.
Any ideas? I would prefer it if was something that had minimal interaction and just kind of worked on the drive by going into each user account and removing those specified files.
 

statik213

Golden Member
Oct 31, 2004
1,654
0
0
I doubt if there is already a prewritten script for this... you'll probably need to write this one yourself.
 

statik213

Golden Member
Oct 31, 2004
1,654
0
0
Originally posted by: Nocturnal
Any recommendations for a language? Or a simple batch file?

You can do what you want with a windows batch file.. look at the windows help and search for "for" or type help for at the cmd prompt.

On the other hand this would be a good excuse to learn python or perl but if you don't want to install python or perl on the machines to run the script learn VBScript.


I have a batch file that does something similar to what you want (see below).
It basically CD's to the temp directory
Then loops through all the folders (*.*) and checks to see if the file or folder is not "sessiondata" and deletes them.
Not sure why i used this specific script but it was to clean my temps directory.... the sessiondata thing is from when i used to do php and didnt want to del my session info.

You should be able to adapt this to what you want.


----
Code:
@ECHO OFF

ECHO "%DATE% %TIME% - Begin Deleting Temp. Files

PUSHD %temp%

FOR /D %%v IN (*.*) DO (
    IF NOT "%%v"=="sessiondata" (
       ECHO %DATE% %TIME% - Deleting %%v
       RD "%%v" /S /Q
    )
)

POPD