How to copy folder structure but exclude certain files in Windows?
I have a parent folder with hundreds of subfolders containing mainly video files. I would like to replicate its structure 1:1 on another drive, but without copying video files which account for 99% of folder space. Parent folder size is 3TB so copying it and then deleting all video files is not viable solution, it will be too time consuming.
I am using Windows 7
Is it possible in Total Commander?
Using robocopy to duplicate the directory structure
- Open the location of the parent folder in file explorer.
- Hold shift and right click on empty space in the folder and click "Open command window here".
- Type
robocopy "parent folder" "G:\parent folder" /E /XF *
into the command window. Note: Replaceparent folder
with the actual name of your folder and replaceG:
with your actual destination drive letter. Press enter to execute the copy.
Command Explanation:
The command usage is robocopy source destination
/E means copy subdirectories, including empty ones, and /XF means exclude files. We have indicated the wild card character *
for exclude files in order to exclude all files and only reproduce the directory structure.
Thanks to @Darius for the suggestion.