1.

Solve : Delete a folder under several users profiles.?

Answer»

Hey all.

I'm in over my head here, i dont know how to do veriablaes just yet in scripts, never really had to use them MUCH untill my current job... Anyways I'm looking for a way to delete a directory that appears under several users profiles.

The directory and path structure stays the same just the user log in name will vary, and i also dont know what the user names will be on each computer i have to run this on, but being that thats is the VARIABLE that probaly WONT matter all that much.

Ex: C:\documents and setting\casey131\DeleteMe
C:\documents and setting\casey242\DeleteMe
C:\documents and setting\casey353\DeleteMe

I wont ask you to write the script for me (all though i wont stop you from doing it either) I just need a good push in the right direction or a good example to get me going.

Thanks in advance for your assistence.
Casey242Casey, 2ND from the bottom...the "FOR" statement.

Let me know if it helps...

http://www.servergig.com/dos/Thats thats what i'm PLAYING with now.
After playing with it for a while this does not give me any errors but does not delete the folders either.

Code: [Select]CLS
FOR %%f IN ("C:\Documents and Settings\*") DO rmdir /q /s "%%f"\delme
pause
EXIT
The out put i get is the same as the command line it just drops one of the %'s
Here is the out put
Code: [Select]C:\Documents and Settings\$n0aedclb\Desktop>FOR %f IN ("C:\Documents and Setting
s\*") DO rmdir /q /s "%f"\delme
I have tried putting the full path for the DO rmdir /q /s c:\Documents and Settings\%%f\delme but that does not work either.

Thanks,
Casey242


Hi,

Try this:

=========
@echo off
cls

cd "C:\Documents and Settings\"
for /d %%a in (*) do (
echo Deleting Deleteme folder in "%%a"
rmdir /s /q "%%a\Deleteme"
echo.
)
=========

I hope that works!



Discussion

No Comment Found