Search code examples
batch-filecmdxcopy

Xcopy, how to not copy empty folders


Here is the code.

xcopy /c/s/z "%appdata%" "./backup"

Is there a way to make it not copy folders with nothing in them?


Solution

  • By specifying the /s switch, the xcopy statement will ignore empty directories and subdirectories by default.