By fkutev22
I want to recreate my folder structure without copying the current files in the folder.
Is this possible with somesort of a command or should I do it manually folder by folder?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi @fkutev,
You can use just the find command. Here is how I would do it
find . -type d > dirs
Once you have your directories in the dirs file, you can make execute the following command to actually create them
xargs mkdir -p < dirs
This will create the directories you wish.
Regards, KDSys
I’ve just found out a small bug in the above commands. If you have spaces in your directory names, the above won’t work properly.
In such a case, you can actually use the following :
find . -type d -print0 >dirs
As soon as the above has finished execute :
xargs -0 mkdir -p <dirs
Regards, KDSys
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.