How to use Robocopy to exclude ALL subfolders under a chosen folder

robocopy

I'm trying to use Robocopy in a way that excludes all subfolders under a chosen folder. In other words, I only want to target a folder and robocopy only the files within it but not it's subfolders. Is there a way to do so?

Best Answer

Excluding subfolders is actually the default behavior of robocopy, or at least the version that comes with Windows 7. (In order to copy the sub-directories you would have to add the /S or /E option to the command.)

So, you can just use robocopy source-folder target-folder.