Windows 10: How to zero size all files in a folder

Page 1 of 2 12 LastLast
  1.    21 May 2018 #1

    How to zero size all files in a folder


    How to zero size all files in a specific folder. And then continuing on, how do I zero any new files placed in that folder in the future.
      My ComputerSystem Spec

  2. pepanee's Avatar
    Posts : 1,079
    Windows 10 Professional
       21 May 2018 #2

    I don't understand fully what you're doing. Please refer to the picture. Is this what you want?

    Click image for larger version. 

Name:	image.png 
Views:	4 
Size:	80.9 KB 
ID:	189706
      My ComputerSystem Spec

  3.    21 May 2018 #3

    Yes. But I need to retain the domain name. So if your depiction is meant to represent the original domain names. This is correct.

    But after this has been completed. There will be other files added which won't have zero file sizes. And I'd like some method of zeroing the size of those files too.
      My ComputerSystem Spec

  4. bro67's Avatar
    Posts : 4,922
    Mac OS High Sierra 10.13.5
       21 May 2018 #4

    stub said: View Post
    Yes. But I need to retain the domain name. So if your depiction is meant to represent the original domain names. This is correct.
    But after this has been completed. There will be other files added which won't have zero file sizes. And I'd like some method of zeroing the size of those files too.
    First there is no domain name in the file naming scheme. Second it would mess up the File Table and MBR, if it saw zero sized files.
      My ComputerSystem Spec

  5.    21 May 2018 #5

    What is your purpose for doing this?
      My ComputerSystem Spec

  6.    22 May 2018 #6

    There's no problem with 0-sized files on any filesystem I know of. Powershell can easily do this.

    Code:
    PS C:\temp\zero> dir
    
        Directory: C:\temp\zero
    
    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    -a----        5/21/2018     23:14             14 www.google.com
    -a----        5/21/2018     23:14             17 www.microsoft.com
    -a----        5/21/2018     23:14             17 www.tenforums.com
    
    
    PS C:\temp\zero> dir | New-Item -Force -Value ""
    
        Directory: C:\temp\zero
    
    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    -a----        5/21/2018     23:15              0 www.google.com
    -a----        5/21/2018     23:15              0 www.microsoft.com
    -a----        5/21/2018     23:15              0 www.tenforums.com
      My ComputerSystem Spec

  7.    22 May 2018 #7

    @bro67 - Sorry. I was tired when I sent my last reply. I'm sorry about that. Domain Name should be File Name. But I'm confused about what you say about the MBR and file table.

    @margrove55 - The purpose is I'm continually receiving new files into this folder, and when after I have processed them, I want to convert the original files in the folder to zero bytes, so that I cannot receive the same files twice and process them twice.

    @PolarNettles - What is Powershell? Does this come as part of Win10? I know I'm showing my noobness. If not. Where to get it. Is this the exact command I need to run or are these parameters only? And if so, What is the exact command line required to achieve this effect.

    And then to the second part of my question? How to zero-ize only the filenames which have file sizes, the next I time run the command. Is that even possible?
      My ComputerSystem Spec

  8.    22 May 2018 #8

    Powershell is built in to Win 10. You can write PowerShell scripts similar to batch files. There are tutorials and courses available online, such as Getting Started with PowerShell 3.0 Channel 9 .

    You can write the PS script to only zero out files with size > 0. This would be a good exercise as you are learning it.
      My ComputerSystem Spec

  9. bro67's Avatar
    Posts : 4,922
    Mac OS High Sierra 10.13.5
       23 May 2018 #9

    You do not want to set file size to 0. It will mess up the MBR and File Tables. There is zero reason to even do what you are doing.
      My ComputerSystem Spec

  10.    23 May 2018 #10

    bro67 said: View Post
    You do not want to set file size to 0. It will mess up the MBR and File Tables. There is zero reason to even do what you are doing.
    Please provide proof. Zero-sized files are used all the time . And why would the "file table" affect the MBR?

    Code:
    PS D:\> dir
    
    
        Directory: D:\
    
    
    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    -a----        5/21/2018     23:21              0 www.tenforums.com
    -a----        5/21/2018     23:21              0 www.google.com
    
    
    PS D:\> chkdsk /offlinescanandfix
    The type of the file system is FAT32.
    Cannot lock current drive.
    
    Chkdsk cannot run because the volume is in use by another
    process.  Chkdsk may run if this volume is dismounted first.
    ALL OPENED HANDLES TO THIS VOLUME WOULD THEN BE INVALID.
    Would you like to force a dismount on this volume? (Y/N) y
    Volume dismounted.  All opened handles to this volume are now invalid.
    Volume NEW VOLUME created 5/20/2018 08:03
    Volume Serial Number is F8C1-E6AD
    Windows is verifying files and folders...
    File and folder verification is complete.
    
    Windows has scanned the file system and found no problems.
    No further action is required.
       15,338,496 KB total disk space.
                8 KB in 1 hidden files.
               16 KB in 4 files.
       15,338,464 KB are available.
    
            8,192 bytes in each allocation unit.
        1,917,312 total allocation units on disk.
        1,917,308 allocation units available on disk.
    PS D:\> Get-Volume -DriveLetter D
    
    DriveLetter FriendlyName FileSystemType DriveType HealthStatus OperationalStatus SizeRemaining     Size
    ----------- ------------ -------------- --------- ------------ ----------------- -------------     ----
    D           NEW VOLUME   FAT32          Removable Healthy      OK                     14.63 GB 14.63 GB
      My ComputerSystem Spec


 
Page 1 of 2 12 LastLast

Related Threads
Solved Folder size in General Support
In W10, is there a way to always make folders open maximized. I always close them maximized, but the next time I start computer and open them, they are minimized. Thanks for looking.
Solved Size of Users folder in General Support
Hello! I have just a little query really. I have a 175GB C: Windows drive. At the moment it has 102GB used. However 47.5GB is the C: Windows/Users folder. I have moved all the pictures, videos and music from this folder to their own dedicated...
size of c:\windows folder in General Support
When I use file explorer and select c:\windows and then select 'properties' it shows size on disk = 16.6GB. When I enter that folder and select ALL files including hidden ones , the properties show size on disk at 6.4GB. chkdsk /F indicates...
Folder Size in General Support
Hi Group, I have an internal hard drive, 1 TB, just for data. If I add up the sizes of all the folders, it is about 75 GB. But properties for the drive show it has 455 GB of data. I know it has nowhere near that. The red line appears showing it...
Windows Folder Size greater than Size on Disk in Performance & Maintenance
My 32GB Windows 10 Home PC (recently upgraded from 8.1) is low on disk space. I deleted Windows.old and I have hibernation disabled. Apart from a few browsers, very little else is installed, yet I only have 11.7GB left? One reason may be the size...
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:02.
Find Us