Last Updated: February 25, 2016
· stevenschobert

Copy folder structure without contents

When setting up build processes, I often find myself needing to copy a source directory's folder structure to the build destination, but I don't want to copy the files; just the folder structure.

If you find yourself running into this scenario often too, take a look at this handy bash command:

find IN_DIR/* -type d | sed 's/IN_DIR\///' | xargs -I % mkdir -p OUT_DIR/%

Replace IN_DIR and OUT_DIR with your actual folder names.