Hi Monks I would welcome any suggestions as to the best way to resolve this problem

I have on a centos server about 7000 files mostly pdf in one directory. I need to download about 4000 of them for which I have a list in a csv or txt file of their names.

I am thinking the best way to approach this is to run a script from the command line to copy the files required into a new directory using a script something like that below and then I can download them .

However I am always open to any suggestions of any other methods that would achieve a solution to this problem Thank You

#!/usr/bin/perl -w open FILE , '<' , "mylist.txt" || die "$!"; while (<FILE>){ chomp; system("cp $_ newdirectory/"); } close FILE;

In reply to Copying a list of files from a directory to a new directory by ramjamman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.