computing
  • 0

How To Change All Files To Zero-Byte?

  • 0

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.

Share

1 Answer

  1. The zerolgt command should be issued from another directory with the target folder as a parameter, e.g.

    C:\My dir>zerolgt C:\Documents and Settings\user\My Folder

    However if you want to store it in the same folder holding the target files, use the following version

    :: zerolgt.bat Usage: zerolgt Folder_Name
    @echo off
    pushd %*
    for %%j in (*) do if /I not "%%j"=="%~nx0" type nul > "%%j"
    popd
    :: End_Of_Batch
    

    The above script doesn’t clear itself.

    • 0