Find the answer to your Linux question:
Results 1 to 3 of 3
Hi folks, I'm trying to wrap my head around a problem and was hoping that a brainiac out there could help me out. I have a text file that contains ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2012
    Posts
    7

    Locate and copy list of files on local drive


    Hi folks,

    I'm trying to wrap my head around a problem and was hoping that a brainiac out there could help me out.

    I have a text file that contains several hundred file names that look like this:

    A002_C006_1119YZ.MOV
    A003_C005_1119A1.MOV
    A005_C004_1119SZ.MOV

    I'm trying to work out how to run a "find" command for all of the files, and then copy them to a local drive. I know the individual commands but not how to string them all together.

    Any help would be gratefully received!

    Best,

    Patski.

  2. #2
    Linux Newbie
    Join Date
    Nov 2012
    Posts
    211
    hi,

    Code:
    find <optionS> -exec sh -c '<commandS> "$1"' _ {} \;
    which passes one file at a time to sh
    or
    Code:
    find <optionS> -exec sh -c '<commandS> "$@"' _ {} \+
    which passes every files at the same time to sh.

    _ is a dummy parameter because sh when used with -c, starts its positional parameters at $0, and $@ starts at $1.

  3. #3
    Just Joined!
    Join Date
    Jan 2012
    Posts
    7
    Thanks a lot for replying Watael - I'll give it a try!

    Best

    Patski

Posting Permissions

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