Let’s say you have a folder C:\dir1 and within \dir1 you have some files and some folders. You want to copy the folders but not the files to a different directoy C:\dir2. How can you do this using Robocopy?
You can do it like this:
for /f “delims=” %f in (‘dir/b/ad C:\dir1’) do robocopy /e C:\source\%f C:\dir2\%f
Mitch Tulloch is a seven-time recipient of the Microsoft Most Valuable Professional (MVP) award and widely recognized expert on Windows administration, deployment and virtualization. For more tips by Mitch you can follow him on Twitter or friend him on Facebook.