Some feedback on simple batch file

Jun 18, 2008
8
0
I must have written the following batch file some time ago.

Can anyone explain if this is more efficient then just running a

del /[d-15,1/1/80] /s /y http\...\upload\*.jpg

Is there a performance gain running against a file list?

Code:
@echo off
d:
cd\
cd http\domain\uploadtool-pro\upload
dir /a:d /b >c:\scripts\cleanupdir\dirlisting.txt
for %files in (@c:\scripts\cleanupdir\dirlisting.txt) del /[d-15,1/1/80] /s /y %files\hi-res\*.jpg >>e:\logs\cleanupdir\%_month%-%_day%-%_year%cleanup.log 
exit

additionally can you recommend a way to not log 0 files deleted 4000 times and only show the actual deleted files.

And last but not least is there a way for these logs to show the total number of files deleted and bytes freed.

I am needy <G>... Thanks either way

sample of log snippet


0 files deleted
Deleting D:\Photogra\UploadTool-PRO\upload\VENTURA\hi-res\8613945.JPG
Deleting D:\Photogra\UploadTool-PRO\upload\VENTURA\hi-res\8613947.JPG
2 files deleted 1,052,672 bytes freed
 
May 20, 2008
3,515
4
Elkridge, MD, USA
dcohn wrote:
| I must have written the following batch file some time ago.
|
| Can anyone explain if this is more efficient then just running a
|
| del /[d-15,1/1/80] /s /y http\...\upload\*.jpg
|
| Is there a performance gain running against a file list?
|
|
| Code:
| ---------
| @echo off
| d:
| cd\
| cd http\domain\uploadtool-pro\upload
| dir /a:d /b >c:\scripts\cleanupdir\dirlisting.txt
| for %files in (@c:\scripts\cleanupdir\dirlisting.txt) del /[d-15,1/1/80]
/s /y %files\hi-res\*.jpg
>>e:\logs\cleanupdir\%_month%-%_day%-%_year%cleanup.log
| exit
| ---------

The two schemes would not delete the same files.
- The stand-alone DEL deletes all *.jpg files at least 15 days old from the
...\upload directory and all its subdirectories.
- The "dirlisting" method will not delete anything from the ...\upload
directory, only from its subdirectories.

| additionally can you recommend a way to not log 0 files deleted 4000
| times and only show the actual deleted files.

You did not specify the command processor you use. If you use V7 or later,
/Ns option suppresses the summaries.
|
| And last but not least is there a way for these logs to show the
| total number of files deleted and bytes freed.

You cannot have your cake (final report) and eat it, too (throw away parts
of the report). You can use FFIND or another method to filter the report
(e.g. report all lines that do not contain the text " 0 files").

NOTE that in V9 you can use inverted ranges, i.e., /![d-14] is a range that
excludes files less that 15 days old.

--
HTH, Steve
 

samintz

Scott Mintz
May 20, 2008
1,514
18
Solon, OH, USA
Have you tried the /E switch on the DEL command? That's what I use when I
only want to see what's being deleted.

-Scott



Steve F$BaC(Bi$BaO(B <> wrote on 07/06/2008 09:24:00 AM:


> | additionally can you recommend a way to not log 0 files deleted 4000
> | times and only show the actual deleted files.
>
> You did not specify the command processor you use. If you use V7 or
later,

> /Ns option suppresses the summaries.
> |
> | And last but not least is there a way for these logs to show the
> | total number of files deleted and bytes freed.
>
 
Similar threads
Thread starter Title Forum Replies Date
Joe Caverly CMDebug v23 Help: /FEEDBACK /UPDATE Support 0
Charles Dye Re: Feedback Forum Changes Support 9
rconn News Feedback Forum Changes Support 0
S Feedback URL Support 6
S How to? Use Forum "feedback" button to open in a new tab Support 3
S How to? Connect to the FEEDBACK site when images are disabled Support 1
vefatica Can't give feedback! Support 1
dcantor Feedback site problem Support 4
S FEEDBACK forum Support 14
rconn New JP Software feedback forum Support 14
samintz How to? TPIPE /simple=61 Support 6
GermanDirk How to? EVENTLOG Command with simple User Rights not functional Support 4
H TPIPE /simple=4 Support 12
T How can I send a simple parameter to a script, in tc 25? Support 2
C No simple way to tell new Alerts Support 8
P Simple RegEx copy Support 9
C WAD tpipe /simple=28 Support 8
C tpipe /simple=28 error Support 5
P WAD TC 15.0.1.58 x64 crasches with a simple dir command Support 18
M Maybe Maybe I'm being stupid (again), but a simple question... Support 4
M What am I doing wrong in this (very simple!) code? Support 3
M How to? A very simple question re. the current line number in a batch file... Support 2
C Simple .bat question - dump contents of 2 dimensional array Support 2
M Another simple question re. Take Command/TCC window witdth in characters... Support 16
M Simple question about "Function" command... Support 4
M A simple question related to the "dir" (and "pdir") commands... Support 5
P "Simple question" concerning insert/overstrike mode Support 17
fpefpe How to? shortcuts and batch files Support 4
vefatica `Back quotes` - command line vs. batch file Support 5
fpefpe How to? batch file size Support 2
FreezerBurnt Help making a CMD and TCC compatible batch file Support 7
M Oracle batch OPatch.bat.bat not working in TCC but correctly in CMD Support 5
Joe Caverly Set a batch variable (%1 - %n) when TCC is executing a batch file Support 5
P Kill all other instances of tcc from a btm batch file Support 2
fpefpe batch file ending early Support 18
R Batch Debugger Command Expansion Window Support 3
K robocopy cancelling batch file processing Support 28
A Unable to pass batch file arguments unaltered Support 18
K Batch debugger not stepping correctly Support 4
S incorrect message at start Cancel batch job 4START.bat ? (Y/N/A) : Support 1
MickeyF Why does this batch file give me 'unknown command "else"' error? Support 17
Joe Caverly "Functions" in cmd.exe batch files Support 6
S Batch files Calling Batch Files Support 2
P exit /b in batch files Support 7
P Labels in batch files: TCC vs CMD.exe Support 9
vefatica Batch parameters broken? Support 2
cxxl Set encoding for batch file Support 4
dcantor How to? Batch file to be executed by TCSTART Support 4
J New lexer for TCC batch files. Support 0
T Fixed Problem with use of Batch parameters in the IDE Support 1

Similar threads