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

Page 1 of 4 123 ... LastLast

  1. Posts : 222
    Windows 10 Pro
       #1

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


    Is there a Windows program (not a batch file) that will zero out all files in a folder?

    I'm using Windows Pro v21H2.

    Thank you.
      My Computer


  2. Posts : 6,572
    Windows 11 Pro - Windows 7 HP - Lubuntu
       #2

    Do you want to convert files, with data on them, to files with no data (0 bytes) and same name?
      My Computers


  3. Posts : 17,041
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #3

    Assuming that I have understood your requirements correctly, I suggest you
    - Make a backup copy of the chosen file somewhere,
    - Create a new text file anywhere convenient such as your Desktop,
    - Rename the text file to the full name & file extension of the chosen file,
    - Copy the renamed text file into the folder containing the chosen file.

    Or have I misunderstood your requirements?


    All the best,
    Denis
      My Computer


  4. Posts : 222
    Windows 10 Pro
    Thread Starter
       #4

    Try3 said:
    Assuming that I have understood your requirements correctly, I suggest you
    - Make a backup copy of the chosen file somewhere,
    - Create a new text file anywhere convenient such as your Desktop,
    - Rename the text file to the full name & file extension of the chosen file,
    - Copy the renamed text file into the folder containing the chosen file.

    Or have I misunderstood your requirements?


    All the best,
    Denis
    Hi, thank you for the reply.

    I'm looking for a very simple solution.

    Example: FolderT contains files a.txt, b,com, c.mkv, d.avi, e.mp3, *.exe, etc. All of varying file sizes.

    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


  5. Posts : 4,878
    Windows 11 Pro 64 Bit 22H2
       #5

    We are still confused what it is you are trying to do?
    There is no one program that you can right click a folder and make all the files turn into 0 kb's Unless you delete all the files.

    You can do this by manually creating 0 kb files and renaming them to the various names and extensions you have in the folder.
    First,allow viewing a File Extensions in File Explorer.
    If you have, lets say songtitle.mp3 which is 20MB's in size if you choose to create a new text file inside this folder, it will be 0 kb. If you move songtitle.mp3 or delete it, then rename the new text file to be songtitle.mp3, the file will convert to an .mp3 file and be 0 kb's in size. Do this for all the other files in this folder.

    But don't know why you would want to do this?
      My Computer


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

    Sounds more like a virus/ransomware. Sabotage all files.
    Why keep 0byte files as they is useless afterwords..
    If you want prevent a program to re-create those files, Just delete the content of folder, then change folder permissions so no new files can be created in that folder.
      My Computer


  7. Posts : 222
    Windows 10 Pro
    Thread Starter
       #7

    spunk said:
    We are still confused what it is you are trying to do?
    There is no one program that you can right click a folder and make all the files turn into 0 kb's Unless you delete all the files.

    You can do this by manually creating 0 kb files and renaming them to the various names and extensions you have in the folder.
    First,allow viewing a File Extensions in File Explorer.
    If you have, lets say songtitle.mp3 which is 20MB's in size if you choose to create a new text file inside this folder, it will be 0 kb. If you move songtitle.mp3 or delete it, then rename the new text file to be songtitle.mp3, the file will convert to an .mp3 file and be 0 kb's in size. Do this for all the other files in this folder.

    But don't know why you would want to do this?
    Thanks. Why do I want to do this? To create a folder that preserves the names of deleted files but that doesn't take up space. It behaves like the Windows trash folder which contains the names of deleted files but whose file names are preserved indefinitely.
      My Computer


  8. Posts : 43,296
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #8

    Any reason a simple list of those names wouldn't meet your needs?

    You could do what you want in 2 stages.

    a. Create a txt file containing a list of the file names (with extensions).
    (Various ways around to do that).

    b. Process that txt file to create zero byte files of the required names.
    Ideas here:
    notepad++ - Easy way to make many files with names from the list - Super User
      My Computers


  9. Posts : 17,041
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #9

    bofhlusr said:
    The file contents don't have to be replaced with zeroes.).
    If the file contents remain then the files will not be zero size.

    I suggest you search the forum
    https://www.tenforums.com/search.php?query=
    because I think this question has been asked before.
    This one about reducing to 1 byte might be the old thread I was thinking of Reducing file size of all files in a folder to 1 byte - TenForums That OP's reason seems to me to be the same as yours and I think @das10's solution in its post #8 will also be a suitable solution for you.


    Best of luck,
    Denis
    Last edited by Try3; 14 May 2023 at 08:26.
      My Computer


  10. Posts : 1,681
    X
       #10

    Or ...
    1. Go to the folder. In command line: cd <your-folder>
    2. Create a list of the file names. In command line: dir /w >C:\files.txt
    3. Delete all the files in that folder. In command line: rm *.*
    4. Move the file with the file names to this folder. In command line: copy C:\files.txt .
      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 07:54.
Find Us




Windows 10 Forums