


I am aware that command line copying is faster, and it what I do when I need to copy a very large amount of data, but dropping to a command line to save several seconds is probably not worth it. Zipping the files will not make the copy significantly faster since the system still has to read all the files on zipping and then write them on unziping, while adding another overhead and making a common operation less convenient. Is this the best I can expect or are there ways to speed it up? When I copy a large file in explorer, Windows reports around 200 MB/s:īut copying a large folder of many small files can be up to three orders of magnitude slower: # Exluce folder: If (($subItems -eq $null) -and (-Not($path.Samsung magician reports these characteristics for my NTFS-formatted SSD: # If there are no items, then we can delete the folder $subItems = Get-ChildItem -Force:$getHiddelFiles -LiteralPath $path Depending on removeHiddenFiles settingįoreach ($subFolder in Get-ChildItem -Force -Literal $path -Directory)ĭelete-EmptyFolder -path $subFolder.FullName The script will then ignore the hidden files and remove the folder including the hidden files with it. So to remove those empty folders as well you can set removeHiddenFiles to $true. These folders appear to be empty, even with show hidden files in Explorer, you don’t see the Thumbs.db. Windows makes a hidden file, Thumbs.db, in folders with images in it. If you want to test the script first, which I really recommend doing, then you can set the variable $whatif to $true. Remove Empty Directories with PowerShellīelow you will find the script to remove empty directories with PowerShell.

I have also tested the PowerShell and RoboCopy script against a directory with 11.000 empty subdirectories to see which option is the fastest. It’s always a good idea to list the empty directories first, so I added the option in both scripts.īelow an example for both scripts. With the use of PowerShell or RoboCopy, both included in Windows 10, we can delete all empty folders and subfolders. There is really no need to install any program to clean up the empty directories on your computer or server. Removing empty directories in Windows 10 is really simple with a small PowerShell script or RoboCopy cmd.
