Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Some feedback on simple batch file

Jun
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
 
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
 
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.
>
 
Back
Top
[FOX] Ultimate Translator
Translate