Hi,
try this
for %%f in (ws_ftp.log\*.*) do del %%f
if you want to results of del command call a secand batch:
:: batch1.bat
for %%f in (ws_ftp.log\*.*) do call batch2 %%f
:: batch2.bat
del %1 >> delfiles.txt
I hope this helps
Georg Pohl
I run a little program called WS_FTP which leaves it's log files all
over the place, in whichever directory you ftp files from /to, so I
understand what you're trying to do - find and delete all the ws_ftp.log
files on your disk.
I can't think of a way to do that with DOS commands, but using PKzip
dir /b /s ws_ftp.log >delfiles.txt
pkzip -m wslogs.zip @delfiles.txt
del wslogs.zip
The '@' option denotes a list file that contains a list of files to be
zipped.
The '-m' move parameter will move the files in the list into the zip
file.
Maybe there's a DOS command that supports list files ...
PKzip is shareware, blah, blah, try a search on pkzip.exe or
www.pkware.com.
Anyway thanks for the hint, this batch file finds twelve WS_FTP.LOG
scattered
all over my HDD taking up ... 40K!
:: YASWP.BAT - Yet another procedure to 'sweep' a directory structure.
:: Special thanks to Eric Phelps for the idea gleaned from
:: his fine webspace: http:/www.calweb.com/~webspace/batch/
:: Tom Lavedas <lav...@pressroom.com>
:: http://www.pressroom.com/~tglbatch/
@echo %dbgs% off
if '%2==' echo Syntax: %0 FileSpec Process [Args]
if '%2==' goto End
attrib /s +a %1
attrib /s %1 |find/v " S"|find/v "R "|find/v " H "> %temp%.\{t}.!@#
echo exit >> %temp%.\{t}.!@#
for %%v in (1 2) do shift
if exist A.bat ren A.bat %%A%%.tab
for %%v in (/ % Win 9x only %) do set _T=\..\%%2
echo %0 %%1%_T% %1 %2 %3 %4 %5 %6 %7 %8 %9 %%"%%<con>con%%"%% > A.bat
%comspec% < %temp%.\{t}.!@# > nul
set _T=
for %%v in (%temp%.\{t}.!@# A.bat) do del %%v
if exist %%A%%.tab ren %%A%%.tab A.bat
:End
:: In your case, it would be called from a command prompt something like
this ...
:: yaswp ws_ftp.log del
That was Tom's XLNT solution, here's what I threw up, er, together:
(running Win95 OSR2, DOS 7)
@echo off
if '%1==' echo Syntax: DELFILES filename
if '%1==' echo will search 'this dir and below' for 'filename'
if '%1==' goto end
:: turn on archive attribute of log files (this gives a command line
:: starting with 'A', which will run A.BAT)
cls
echo Searching for files that match %1 ..
attrib +a %1 /s
:: if can't find files by that name
if errorlevel==1 goto end
:: get rid of those with shareable, read-only or hidden flags
attrib %1 /s |find/v " S"|find/v "R "|find/v " H " > delfiles.txt
echo Files found :
type delfiles.txt
echo.
echo If you not are ready to delete them, press [Ctrl C] now, otherwise
pause
:: add this in order to exit command interpreter when done
echo exit>> delfiles.txt
echo Deleting all %1 files ..
:: create delete command for the 2nd var in A.bat
echo @del %%2 > a.bat
:: feed contents of file to command interpreter which runs A.BAT
%COMSPEC% < delfiles.txt > nul
echo Done!!
:end
:: delete temp files
for %%d in (delfiles.txt,a.bat) do if exist %%d del %%d
Works like a charm!! no more pesky WS_FTP.LOG or even FAILURE.LOG
Deletes one or more groups of files.
MDEL [d:][path]filename [...] [/R | /H] [/P | /Y] [/S] [/Z]
[d:][path]filename Specifies the file(s) to delete. Specify multiple
files
by using wildcards. Multiple filenames can be
specified
on the command line separated by spaces.
/R Allows deletion of read-only files.
/H Allows deletion of read-only, hidden, and system
files.
/P Prompts for confirmation before deleting each file.
/Y Do not prompt for confirmation before deleting all
files
in a directory (*.*).
/S Deletes matching files in subdirectories. This
switch
applies to all filenames on the command line.
/Z Deletes only zero-length files.
Press CTRL+C, ESC, or Q to stop MDEL at any time.
ERRORLEVEL Values
1 Invalid file specification
http://bigfoot.com/~batfiles/download/mdel.zip
Regards,
Outsider
Maurice Delaney wrote:
>
> Dear Mr A Flux,
>
> I run a little program called WS_FTP which leaves it's log files all
> over the place, in whichever directory you ftp files from /to, so I
> understand what you're trying to do - find and delete all the ws_ftp.log
> files on your disk.
>
> I can't think of a way to do that with DOS commands, but using PKzip
>
> dir /b /s ws_ftp.log >delfiles.txt
> pkzip -m wslogs.zip @delfiles.txt
> del wslogs.zip
>
> The '@' option denotes a list file that contains a list of files to be
> zipped.
> The '-m' move parameter will move the files in the list into the zip
> file.
>
> Maybe there's a DOS command that supports list files ...
>
> PKzip is shareware, blah, blah, try a search on pkzip.exe or
> www.pkware.com.
>
> Anyway thanks for the hint, this batch file finds twelve WS_FTP.LOG
> scattered
> all over my HDD taking up ... 40K!
>
Bill James
------------snip>
>Works like a charm!! no more pesky WS_FTP.LOG or even FAILURE.LOG
------------snip>
;-)
Georg Pohl