I would like to know how to copy all folders to a new location, but I want only to include the folders themselves -- nothing that is inside of them (so, no subfolders, and no files). Is this possible?

Also, related to this, is there also a way to copy all folders, and also subfolders within those folder, but only 1-level deep (so only direct child folders, not children within the children), and still without any files copied.

I'm open to doing this in any way -- command line, or via a utility.

3 Answers 3


Use the Microsoft utility robocopy.



  • /E Copy Subfolders, including Empty Subfolders
  • /LEV:1 Only copy the top n LEVels of the source tree.
  • /XF * eXclude Files matching given names/paths/wildcards.

Source: http://ss64.com/nt/robocopy.html

  • I can confirm that /LEV:2 was required to copy one level of folders within the cited folder. /LEV:1 appears to be the folder cited itself.
    – HackSlash
    Mar 3, 2020 at 16:42

Just to add to Steven's answer, it seems that if you want all the folders within folder X, you'll need to specify folder X as the source and then use /LEV:2, not /LEV:1 (I'm guessing /LEV:1 is just folder X). This is what worked for me just now.

(Would've added this as a comment in reply to Steven's answer, but I don't have the privileges (low reputation).


Using a command line, if you want to copy just empty folders, that is creating the folders on a new location say somewhere on c:...:

set newlocation=c:\...
@for /f "tokens=3,4" %i in ('dir') do @if "%i" equ "<DIR>" if "%j" neq "." if "%j" neq ".." mkdir %newlocation%\%j

If you want to go one level deep, it's to repeat the for loop once again:

@for /f "tokens=3,4" %i in ('dir') do @if "%i" equ "<DIR>" if "%j" neq "." if "%j" neq ".." mkdir %newlocation%\%j && for /f "tokens=3,4" %u in ('dir %j') do @if "%u" equ "<DIR>" if "%v" neq "." if "%v" neq ".." mkdir %newlocation%\%j\%v

Note that if you want to put this into a batch file, replace all % by %%.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .