Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

howto pipe dir output to del?

1,413 views
Skip to first unread message

G.Pohl

unread,
Sep 8, 1999, 3:00:00 AM9/8/99
to

AeonFlux® schrieb in Nachricht
<5snVN=+wAaCCcw8pC...@4ax.com>...
:
:How do I get these lines to work?
:
:
:dir /b /s ws_ftp.log | del >delfiles.txt
:
:or this...
:
:dir /b /s ws_ftp.log >test.txt
:del <test.txt
:
:I know it's late, my mind must be asleep;)
:
:
:AeonFlux®

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


Maurice Delaney

unread,
Sep 8, 1999, 3:00:00 AM9/8/99
to
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!

Maurice Delaney

unread,
Sep 8, 1999, 3:00:00 AM9/8/99
to
Just downloaded this from a Tom Lavedas mail - is pretty 'orribel but I
below it you'll see I've simplified it to deal with just deletes of any
filespec anywhere on the disk.

:: 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

Outsider (6.22/3.11)

unread,
Sep 8, 1999, 3:00:00 AM9/8/99
to
There is also another way. You could use a global delete
utility such as mdel.exe. It's fast, shows the files deleted
and tells you how much space you've recovered. The output
can be redirected.

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

unread,
Sep 8, 1999, 3:00:00 AM9/8/99
to
If it's just the WS_FTP.LOG that are a problem, turn them off by un-checking
the "Enable Log" checkbox in Options, General tab.

Bill James

------------snip>


>Works like a charm!! no more pesky WS_FTP.LOG or even FAILURE.LOG

------------snip>


- stdIN -

unread,
Sep 9, 1999, 3:00:00 AM9/9/99
to
No way to run deltree from ftp?
That would be an easier way to wipe someone out remotely.


-*JustSomeDudeOk?

unread,
Sep 11, 1999, 3:00:00 AM9/11/99
to
bloody ws_ftp and there stupid and annoying log files, they place em
everywhere they f**king like, loosers, use cuteftp hehe.

G.Pohl

unread,
Sep 15, 1999, 3:00:00 AM9/15/99
to

-*JustSomeDudeOk? schrieb in Nachricht
<37D94F82...@cyberthrill.com>...
:bloody ws_ftp and there stupid and annoying log files, they

place em
:everywhere they f**king like, loosers, use cuteftp hehe.
:
That was not asked

;-)

Georg Pohl

0 new messages