How to convert files to zero sized files in a folder?

Page 2 of 4 FirstFirst 1234 LastLast

  1. Posts : 219
    Windows 10 Pro
    Thread Starter
       #11

    dalchina said:
    Any reason a simple list of those names wouldn't meet your needs?
    A list will have issues: version control. Every time I delete or zero out a file over time, it will require a new list. And there are literally thousands of folders and at my last check about a million files in my appdata folder.

    Putting it another way: I'm looking for an alternative trash folder that I can retain indefinitely. At the end of the year I'll compress these pseudo-trash folders eg. Trash2021.zip, Trash2022.zip, Trash2023, etc.

    I know zero byte files occupy some space but that's something I can live with.

    @Try3, thank you for the link. I followed and read it. Also, what I meant that the contents don't have to be erased with zero's is that they don't have to be securely erased or wiped or replaced with zero's. The space can be re-used by Windows just like in Windows' trash folder. It's just that I want to preserve the filenames indefinitely (I hope I'm describing that clearly).

    Here's what I'm looking for. A really simple solution. Hopefully it exists.

    1. In Windows Explorer select FolderT and right click
    2. Run the desired program
    3. All the files in FolderT now contain the same files except they are now all have 0 bytes (files are *simply* converted and now show a file size of 0 bytes. The file contents don't have to be replaced with zeroes.).
      My Computer


  2. Posts : 16,597
    Windows 10 Home x64 Version 22H2 Build 19045.4046
       #12

    No, I think that solution posted by das10 is the only existing solution.

    You could take it further by writing that solution to act on a "passed parameter" and sticking a shortcut to it in the C:\Users\%UserName%\AppData\Roaming\Microsoft\Windows\SendTo folder.
    That will pass the selected path to the script so it acts on that.
    I do that with some of my scripts. Sometimes it's an easy change to make an existing script [such as a batch file] operate that way but sometimes it can be rather fraught.

    I avoid the issue entirely by never deleting or reducing the size of any of my files. They're all just there all the time. I fit larger disks if I'm getting short of space.


    All the best,
    Denis
      My Computer


  3. Posts : 219
    Windows 10 Pro
    Thread Starter
       #13

    Try3 said:
    No, I think that solution posted by das10 is the only existing solution.
    ...
    I do that with some of my scripts. Sometimes it's an easy change to make an existing script [such as a batch file] operate that way but sometimes it can be rather fraught.

    I avoid the issue entirely by never deleting or reducing the size of any of my files. They're all just there all the time. I fit larger disks if I'm getting short of space.
    Thank you Denis. I'm hoping someone will view and join this thread and provide a solution as I described.

    For what it's worth I've had this batch file script (not mine), but it's not quite up to the task nor is it as simple as I am wishing for.

    @dir /b *.* > files.txt
    @for /f "delims=" %%n in (files.txt) do @dir /b *.xxx>"%%n"
      My Computer


  4. Posts : 16,597
    Windows 10 Home x64 Version 22H2 Build 19045.4046
       #14

    I suspect that a better batch file solution would make use of the For command to capture the list of files [as its existing das10 version does] from within the selected folder.
    It would not then need to log anything in any text file.
    The only thing missing from your script & das10's is capturing the folder path that SendTo would pass to the script.
    It would be simple in operation - select the folder, right-click, SendTo, click on the script's shortcut that you've put in there.


    @das10 @Paul Black
    Would you be interested in experimenting with such a change?



    Denis
      My Computer


  5. Posts : 219
    Windows 10 Pro
    Thread Starter
       #15

    Megahertz said:
    Do you want to convert files, with data on them, to files with no data (0 bytes) and same name?
    Yes. Hmmm.... the data in the files are made available to be overwritten by WIndows. The old data do not have to be replaced with zero's. Just like a customized 'Trash' folder.
      My Computer


  6. Posts : 42,539
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #16

    bofhlusr said:
    A list will have issues: version control. Every time I delete or zero out a file over time, it will require a new list. And there are literally thousands of folders and at my last check about a million files in my appdata folder.

    Putting it another way: I'm looking for an alternative trash folder that I can retain indefinitely. .
    I guess you didn't read the rest of my post?

    I'll leave you with the others on this. Good luck.
      My Computers


  7. Posts : 219
    Windows 10 Pro
    Thread Starter
       #17

    dalchina said:
    I guess you didn't read the rest of my post?

    I'll leave you with the others on this. Good luck.
    Sorry. Are you referring to creating a text file? I thought I replied. I said I didn't want to mess around with version control issues of the text file over a period of time.
      My Computer


  8. Posts : 3,270
    Win10
       #18

    Denis, re: a batch file for use in the SendTo menu using
    Code:
    For /f "UsebackQTokens=*" %%k In (`Dir /B /a-d /s %*`) DO (type nul > "%%k" )
    as well as a VBS script/utility by Garlin was already posted in one of the OP's older threads.

    How to zero-byte several folders and subfolders in Windows Explorer

    pn: the batch file and Garlin's Context menu script are for 'clearing' the contents of files in a given folder as well as its sub folders.
      My Computers


  9. Posts : 219
    Windows 10 Pro
    Thread Starter
       #19

    das10 said:
    Denis, re: a batch file for use in the SendTo menu using
    Code:
    For /f "UsebackQTokens=*" %%k In (`Dir /B /a-d /s %*`) DO (type nul > "%%k" )
    as well as a VBS script/utility by Garlin was already posted in one of the OP's older threads.

    How to zero-byte several folders and subfolders in Windows Explorer

    pn: the batch file and Garlin's Context menu script are for 'clearing' the contents of files in a given folder as well as its sub folders.
    Thank you for this post. I reviewed the old post. Skimming through them, there seems to be a solution there somewhere at some point in time. (I think that's where I got the batch file that I posted earlier). But which one is simple enough now that all I need to do is install a program, right click on a folder, and all files within the folder become zero byte files?

    I'm really looking for something simpler. Something that doesn't involve batch or text files and also does not require using the command line. I don't mind if it's payware. I hope such a program exists.
      My Computer


  10. Posts : 2,251
    Linux:Debian, Kali-Linux... 2xWin8.1,1x7Pro, Retro:1x2003server.1xXPpro, 1xW2k,1x98SE,1x95,1x3.11
       #20

    One question
    why not just delete the files if you going to destroy them anyway? as 0 byte files cant be restored in the same way trash bin files can.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 22:34.
Find Us




Windows 10 Forums