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
Post a Comment