Jump to content

Script to delete folders


Recommended Posts

cd %ALLUSERSPROFILE%
cd..
for /D /R %%i in (7z*.tmp) do rmdir /S /Q %%i

here's my batch file for deleting all temp directories in "Documents and Settings" folder and all subfolders

The thing is that the line

for /D /R %%i in (7z*.tmp) do rmdir /S /Q %%i

doesn't execute from "C:\Documents and Settings" folder

It executes from whete my batch file is!!!

So the whole script is useless.

Any suggestions??

UPD.:

Found a solution

cd /d %ALLUSERSPROFILE%
cd /d ..
for /D /R %%i in (7z*.tmp) do rmdir /S /Q %%~fsi

Edited by lsrkin
Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...