windows - Delete zero byte files write file name to text file -


i have following in batch script , works deleting files of 0 byte size in target directory how can modify append text file each file name textfile called results.txt

set "targetdir=c:\users\william\desktop\test" /f "delims=" %%a in ('dir/s/b/a-d "%targetdir%\*.*"') ( if %%~za equ 0 del "%%~a" ) 

so in results.txt might see

somefilename.jpg

anotherfile.png

yetanotherfile.jpg

i've tried adding >results.txt various parts of script no luck

set "targetdir=c:\users\william\desktop\test" /f "delims=" %%a in ('dir/s/b/a-d "%targetdir%\*.*"') ( if %%~za equ 0 echo %%~na>>results.txt & del "%%~a") 

try :)


Comments

Popular posts from this blog

android - questions about switching from C2DM to GCM -

c++ - Qt setGeometry: Unable to set geometry -

batch file - How to extract all multi-volume RAR archives from subfolders of a folder? -