MandrivaUsers.org : cp question [solved] - MandrivaUsers.org

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

cp question [solved]

#1 User is offline   Deo Favente 

  • New Here
  • Group: Members
  • Posts: 7
  • Joined: 25-November 07

Posted 23 December 2007 - 11:00 PM

Hi,
i have a question on how to use the cp command. I already comepleted the job, but i would like to know how i could use cp to shorten what i did so i could learn how to use it next time.
So for work i needed to copy a bunch of files. This is what my directory tree looks like:
http://img412.imageshack.us/img412/9344/img001jh2.th.gif
there are 48 directories in level 1. The directories below don't always exsist in all 48 direcetories, but i want the directories abc, def, and ghi and their contents copied over to /usr/somedirectories/lib/
so that there will be lib/abc, lib/def, and lib/ghi. All files have different names (or should- there might be one or two human errors i can take care of manually, never know) so i want everything to merge, and there are plenty of duplicate folders and some folders might be empty.
My current idea is
cp */*/{abc,def,ghi,jkl,mno} /usr/somedirectories/lib/
does this work? what's wrong with it? I've already copmpleted the job so i cant try it on anything.
0

#2 User is offline   Deo Favente 

  • New Here
  • Group: Members
  • Posts: 7
  • Joined: 25-November 07

Posted 24 December 2007 - 01:28 AM

Well what do you know. I tottally forgot i do have another chance to try it! But this time i have 4 levels between the top and the abc, def, ghi folders. So i tried my idea and it didnt work. It printed out "cp: omitting directory " then it listed all the directories that matched, and at the end it printed out "cp: cannot stat */*/*/*/jkl" cause it didnt match any folders. I also learned that all the second level folders were named the same thing cool. So then i tried
cp -R */xyz/*/*/{abc,def,ghi,jkl,mno} usr/somedirectories/lib/

and that worked yay! I hope i remember to prepend [solved] to the topic title.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users