Recursively delete files on a windows box
Image via Wikipedia
I had a large amount of files to delete from a old backup server. I didn?t want to do it through the GUI because this machine did not have much RAM. So I was looking for the syntax to do it on the command line and I found two good resources on it I wanted to share with you.
Tech-recipes had the first quick and easy solution
From the cmd line you can run
del /s *.tmp
It will delete all files ending in tmp from the current directory and all sub directories.
Next daniweb had a post on a batch file to
FOR /F "tokens=*" %%G IN ('DIR /B /AD /S *.svn*') DO RMDIR /S /Q %%G If you're thinking WTF?: ?
DIR /B /AD /S *.svn* lists all files that are named ".svn"
/B makes the output "bare" with nothing but the file name /AD only lists directories /S Displays files in specified directory and all subdirectories if? they match the listing criteria
RMDIR /S /Q [path/name] deletes the directory [path/dir] and all of it's childrenFOR /F processes each item (in this case directories) in the set IN ('[command]') by executing the DO [command]%%G is a parameter, which in this example is a directory name"tokens=*" says that all the characters output in a line (i.e. by the dir command) are assigned to the parameter %%G
See the Microsoft Command Line Reference for more on FOR:
- Windows Command Line Guide – Basic Commands to Speed up Computer (brighthub.com)
Security tools bookmarks
As I'm learning about different security tools and solutions, I keep adding to my bookmarks for follow-up. Today, I'm sharing...
Collection of build numbers
I feel like I'm always looking for an applications history of builds. Sometimes its for windows 10 others for different...
Running office365 on non-persistent VDI desktops
We are working on building our our win10 image with o365 and onedrive. I'm capturing a few links I found...
how to delegate rights to manage printers
Here are some helpful post on setting up delegation on print servers, this includes some powershell scripts to help.
How to configure powershell for o365
Everytime you get a new computer you have to download the latest powershell modules for o365 and it seems like...
online technical training
I've had a few new employees and current employees looking for training on Cisco and Linux training lately. I start...