English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

For instance, I have a directory with about 85,000 files. I know that all of the files that are 10k or smaller are junk. I want to delete all of the junk but going through windows explorer is taking forever. Is there a DOS Batch command that I can use? Any ideas? Thank you.

2006-06-26 07:50:28 · 4 answers · asked by Anonymous in Computers & Internet Programming & Design

4 answers

DOS batch programs resemble shell or perl programming. It is pretty easy. You just need to open up notepad and then write the batch program and make it a .bat file. Then from the MS Command Prompt, just execute the file.

2006-06-26 07:55:12 · answer #1 · answered by Sean I.T ? 7 · 0 0

Fairly easy in Dos, but much easier in Explorer.

For DOS: Do a DIRectory command in the directory of 85,000 files (all in one folder) and redirect this output into a txt file. Like c;, cd dummy, dir *.* >c:\tmp\go.txt. Then sort go.txt by size, that is bring the size column to the first of the file (you'll need a column text editor like IBM Personal Editor, a very old but useful DOS application) and then C;, cd\tmp, sort go1.txt. Go back in to edit go1.txt and remove all _rows_ from the first one up to the starting size you want. Then a few more steps.put c:,
cd\tmp at the go1.txt top, add "del " to all rows below that, get rid of all columns except the filenames beyond the del column, then save go1.txt as go1.bat and invoke it: "go1".

But so much easier to use Explorer! Just display the size attribute column, sort on it (ascending), select the smallest filename and then scroll down to the largest one you wish to delete and SHIFT-SELECT that one, thus selecting a whole bunch of small files, and hit the DEL key! Wow!

You can use the Explorer method in each of your folders in succession without too much trouble, unless you have only a few files per folder.

2006-06-26 15:06:09 · answer #2 · answered by wunhunglow41 2 · 0 0

Hmph. Here is the quick and dirty:

dir /B /OS /OG > tempfile.txt

edit tempfile.txt
remove the directories
remove the block of files at the bottom of the file that are bigger than 10K

then either write batch file to delete files named in file, or edit text file to put "del /q" at the beginning of each line.

2006-06-26 14:58:51 · answer #3 · answered by sideshot72 3 · 0 0

try redirecting the dir /Os to a text file. it will sort files in size order

then use the file for the del command

2006-06-26 14:54:58 · answer #4 · answered by bava 2 · 0 0

fedest.com, questions and answers