Find the answer to your Linux question:
Results 1 to 3 of 3
hey i have a script that finds all the file extensions "txt" and copys them in the folder backup however it doesnt find only extensions txt but just copys all ...
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 i have a script that finds all the file extensions "txt" and copys them in the folder backup however it doesnt find only extensions txt but just copys all the files, any help plz?

    find $HOME \ -name "*.txt" \ -type f | cpio -vdump $HOME/backup

    I am using puppy btw

  2. #2
    Just Joined!
    Join Date
    Aug 2006
    Posts
    8
    Remove the backslashes and it should work fine.

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,572
    Quote Originally Posted by ppatryk View Post
    hey i have a script that finds all the file extensions "txt" and copys them in the folder backup however it doesnt find only extensions txt but just copys all the files, any help plz?

    find $HOME \ -name "*.txt" \ -type f | cpio -vdump $HOME/backup

    I am using puppy btw
    Try this:
    Code:
    find $HOME -type f -iname '*.txt' -exec cpio -vdump $HOME/backup < {} \;
    or as kalling said, remove the backslashes, but also use a single quote around *.txt, as in '*.txt' instead of "*.txt".
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

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