Happy New Year.
I have a solution to this, but I can't make it work unless I am in the directory I want to copy.
At the end of 2018, I want to copy the directory structure only of various folders named 2018/ into 2019/.
cd 2018/
find . -type d -exec mkdir -p ../2019/{} \;
And this works.
How do I do it from the base directory?
find 2018 -type d -exec basename {} \;
gives me the folder names, but
find 2018 -type d -exec mkdir 2019/`basename {}` \;
still copies the 2018 folder into the 2019 folder, and you loose the directory tree.
I can't find a simple answer after multiple searches. Any ideas?
Edit
Thanks for all the help and suggestions. This one ultimately worked best for me:
find 2018/* -type d | sed 's/^2018//g' | xargs -I {} mkdir -p 2019"/{}"
Best Answer
This like should do the trick:
OR
I hope this helps.