N
numismatic
Something like dir /s C:\*.* /O:S, but only return those files with a
0-bit filesize. A way to write it to txt file would be nice too
( >txt.txt???)
0-bit filesize. A way to write it to txt file would be nice too
( >txt.txt???)
Something like dir /s C:\*.* /O:S, but only return those files with a
0-bit filesize. A way to write it to txt file would be nice too
( >txt.txt???)
Tom Lavedas said:Something like dir /s C:\*.* /O:S, but only return those files with a
0-bit filesize. A way to write it to txt file would be nice too
( >txt.txt???)
Try this (presuming WinNT/2K/2003/XP[Vista?]), but beware it could
take quite a while to scan a whole drive ...
(@for /r "C:\" %a in (*.*) do if %~za==0 echo %~fa) > out.txt
If you put it in a batch file, double up the percent signs.
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
Try this (presuming WinNT/2K/2003/XP[Vista?]), but beware it could
take quite a while to scan a whole drive ...(@for /r "C:\" %a in (*.*) do if %~za==0 echo %~fa) > out.txtIf you put it in a batch file, double up the percent signs.
Didn't work properly for me under XP - reported each FOR iteration into the
file. ~z modifier is not available under NT, not sure about 2K.
From the prompt,
@echo off&(@for /r "C:\" %a in (*.*) do if %~za==0 >>out.txt echo %a&echo on
Seemed to work fine though - but you'd have to delete out.txt first as the
output is APPENDED to the file
This solution developed using XP
----- batch begins -------
[1]@echo off
[2]del out.txt 2>nul
[3]for /r "C:\106x" %%a in (*.*) do if %%~za==0 >>out.txt echo %%a
------ batch ends --------
Lines start [number] - any lines not starting [number] have been wrapped and
should be rejoined. The [number] that starts the line should be removed
C:\106x... is my test directory - simply replace with YOUR start-directory's
name.
news:605e0006-2d60-4d21-9a5b-ec39cc91622d@p43g2000hsc.googlegroups.com...Something like dir /s C:\*.* /O:S, but only return those files with a
0-bit filesize. A way to write it to txt file would be nice too
( >txt.txt???)
Try this (presuming WinNT/2K/2003/XP[Vista?]), but beware it could
take quite a while to scan a whole drive ...
(@for /r "C:\" %a in (*.*) do if %~za==0 echo %~fa) > out.txt
If you put it in a batch file, double up the percent signs.
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/Didn't work properly for me under XP - reported each FOR iteration into the
file. ~z modifier is not available under NT, not sure about 2K.From the prompt,@echo off&(@for /r "C:\" %a in (*.*) do if %~za==0 >>out.txt echo %a&echo onSeemed to work fine though - but you'd have to delete out.txt first as the
output is APPENDED to the fileThis solution developed using XP----- batch begins -------
[1]@echo off
[2]del out.txt 2>nul
[3]for /r "C:\106x" %%a in (*.*) do if %%~za==0 >>out.txt echo %%a
------ batch ends --------Lines start [number] - any lines not starting [number] have been wrapped and
should be rejoined. The [number] that starts the line should be removedC:\106x... is my test directory - simply replace with YOUR start-directory's
name.
Thanks to Tom and billious...I couldn't quite get Tom's code to work
either, but I'm sure it's due to my lack of knowledge and not an error
in the code.
billious, your batch file worked perfectly for me, thank you! I can't
believe it's so difficult to retrieve a listing of 0 length files from
the command line without 3rd party sw.
Thanks again!
Actually, even in the %TEMP% folder, if there are no zero-byte files
or none found by the time the TEMP folder is searched, the OUT.TXT
file may well show up in the list (always as the first item in the
list) - Again, nothing's perfect. It could be solved, but I doubt
it's worth the effort.
foxidrive said:for /f creates it's list prior to creating the output file so will solve
that issue. As an aside, I avoid using for /r as it is unreliable in
certain circumstances, and for /f can always replace it.
@echo off
for /f "delims=" %%a in (
'dir c:\ /s /b /a-d'
) do if %%~za==0 echo %%~fa > "out.txt"
Leetle correction:
">>" not ">" otherwise only the last zero-length filename will be placed in
out.txt.
Again, you'd probably need to delete any existing "out.txt" before
executing the FOR
That's why I used the parens around the FOR (to eliminate the need to
delete the OUT file first. Therefore, ...
It was quite useful for me. May I more information regrading the "~fa,
~za, ~???" command for reference?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.