Page 1 of 1
How to change all files to zero-byte?
Posted: 02 Feb 2010 09:27
by auaa
Hi, is there any way I can change all files in a folder to zero-byte length? I need to have the same filenames, just want to change their size to zero. Maybe by creating a batch file.
Please help. Thanks.
Re: How to change all files to zero-byte?
Posted: 02 Feb 2010 11:27
by aGerman
auaano idea what those could be good for
Take a FOR loop and overwrite each file with 0 byte.
Code: Select all
@echo off &setlocal
set "folder=C:\anywhere"
pushd "%folder%"||goto :eof
for %%a in (*) do (
type nul>"%%a"
)
popd
Every found file will be a blank file, also links!
Regards
aGerman
Re: How to change all files to zero-byte?
Posted: 02 Feb 2010 23:13
by auaa
Thanks a lot aGerman, you made my day brighter.
That is the codes that I looked for. It works !!
Actually, I have a program that always update/download new files into certain folders. Eventhough I deleted the old (not-needed files), but this program will always download the same files that I already deleted. That is why I need a way to make the files to zero-byte. This program will still see the files are availalable (although with zero byte), and it will not download the same files into this folder.
Thanks again.