スポンサーリンク

How to copy only the folder structure

スポンサーリンク

I think it is common to create folders on a yearly or monthly basis to manage files. This time, I will show you how to copy only the folder structure from an already existing folder in Windows, but not the files.

Copy command

The command to use is the xcopy command.
xcopy [folder to copy from] [folder to copy to] /e /i /t

Explanation

The parameters of the xcopy command are described in detail on Microsoft’s website, so please refer there.

xcopy
Reference article for xcopy, which copies files and directories, including subdirectories.

xcopy is executed at the command prompt. The command prompt is displayed by pressing [win key]+[R] and typing “cmd” in the “Run” screen.

To create a 2021 folder by copying only the folder structure from a 2020 folder with the following folder structure

├─2020
│ ├─AA
│ │ ├─AAA
│ │ │ AAA_F.txt
│ │ │
│ │ └─AAB
│ └─AB

The command to execute is

The execution result is

├─2020
│ ├─AA
│ │ ├─AAA
│ │ │ AAA_F.txt
│ │ │
│ │ └─AAB
│ └─AB
└─2021
 ├─AA
 │ ├─AAA
 │ └─AAB
 └─AB

The AAA_F.txt file has not been copied, only the folder structure has been copied.

コメント