Sharing Knowledge | System Admin Articles

Linux : Copy only directory structure without copying content

Some times, In Linux and UNIX, you may want to copy only the directory structure without copying the content and you want to create a similar directory structure in some other place. here is the quick way to do that.

Create the parent directory at wherever you want.

mkdir /where/ever/you/want

Example: mkdir /app01/data

switch to the directory from where you want to copy the directory structure.

cd /from/where/you/want/to/copy/directory/structure

Example: cd /app02/data

Now type the following command in the server terminal

find * -type d -exec mkdir /where/you/want/\{\} \;

Example: find * -type d -exec mkdir /app01/data/\{\} \;

Now the directory structure create in the new path where you specified as it is in the source.

Labels: Linux, Tips

My Profile PhotoAbout the Author

I'm Parthiban, An UNIX System Admin by Profession. I'm Experienced in Linux/Unix System Administration and Scripting. I have done lot of work on the infrastructure Mgmt side in Linux, UNIX and Windows system administration, Hardware, Storage and Data center. I'm blogging since 2008.
Follow Me On Twitter or On Facebook

5 Comments for "Linux : Copy only directory structure without copying content"

It's a smart way. Thanks.

It does copy contents of the directories.

does not --preserve associated information

What do you think about this Article? Add your Opinion..!

Back To Top