You are not logged in.
Hello,
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!
Offline
Is this what you're trying to do?
Res publica non dominetur | Larry the CrunchBang Guy speaks of the pompetous of CrunchBang
CrunchBang Forum moderator
Offline
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!:)
Offline
Something like
for f in $(ls ~/a); do mkdir ~/b/$f; done
would do what you want.
Offline
rsync (In the thread Lcafiero linked) seems the neatest way.
rsync --dirs ~/x/ ~/y
@moetunes:
for ... ls ...
will likely break if any folders have spaces in the names.
Last edited by johnraff (2013-11-06 12:11:35)
John
--------------------
( a boring Japan blog , Japan Links, idle twitterings and GitStuff )
#! forum moderator BunsenLabs
Offline
Could also use find . -type d -exec ...
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat