0

A command gives me the path of a folder. I want to copy the content of this folder to the current working directory.

What I tried so far is

bundle show minima  | xargs -I{}  cp -r {} ./

where bundle show minima returns the path of the folder which content I want to copy. However, this copies the whole folder. How can I copy only the folder's content?

  • is the bundle show minima folder name? – RomanPerekhrest Sep 15 '17 at 12:36
  • No, it is a commad returning the path. In my case it returns /var/lib/gems/2.3.0/gems/minima-2.1.1/. – Alex Sep 15 '17 at 12:38
3

try this

bundle show minima  | xargs -I{}  cp -r {}/* ./

but you will miss hidden files (beginning with ".")

  • Thanks for the answer but it still does not work for me. I get the error cp: cannot stat '/var/lib/gems/2.3.0/gems/minima-2.1.1/*': No such file or directory. – Alex Sep 16 '17 at 9:04
  • 1
    I just figured out that replacing * with . seems to work. – Alex Sep 16 '17 at 9:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.