Find the answer to your Linux question:
Results 1 to 2 of 2
hey, trying to find files and copy to another folder, with 2 file extensions, dont know why its not working it is igoring the txt and just copying over doc, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2011
    Posts
    3

    find and copy


    hey, trying to find files and copy to another folder, with 2 file extensions, dont know why its not working it is igoring the txt and just copying over doc, could someone take a wee look? -

    find $HOME -name "*.txt" -o -name "*.doc" -exec cp {} $HOME/test \;

    thank you

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Hey,

    Try wrapping the name parameters in (escaped) parentheses:
    Code:
     find . \( -name '*.txt' -o -name '*doc' \) -exec ls -l {} \;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •