I have 50 folders in ~/x. I want to copy these folders to ~/y, but without their content(so ls would show the same list in both ~/x and ~/y, but files in ~/y are empty).
I looked in man and --help, but I can't find the answer.
Thanks in advance!
Is this what you're trying to do?
Not sure. Figured out how IRC works, so case is solved.
I first made cp -r ~/a/* ~/b
Then, I used rm ~/b/*/*
So effectively, I first copied all folder from one directory to other, and then deleted it's content. I don't know I could have done it easier, but this solution worked. Anyway, thanks for help!:)
for f in $(ls ~/a); do mkdir ~/b/$f; done
would do what you want.
rsync (In the thread Lcafiero linked) seems the neatest way.
rsync --dirs ~/x/ ~/y
for ... ls ...
will likely break if any folders have spaces in the names.
Last edited by johnraff (2013-11-06 12:11:35)