How to copy file from a list to a new folder?Copy/move a list of files to a new directoryHow to separate a given type of file from others?Recursively copying filesmoving the file from one folder to another folderCopy unmatched strings in from one file to another, bulkread file names from files for command lineBash Script to Drag and Drop a File to New LocationMoving only those files that appear in the listFind, Duplicate, Rename and Copy to this foldercopying files resulting from using grep into a new folderSearch folder, find and copy files to new folder corresponding file ending

The IT department bottlenecks progress. How should I handle this?

Why did the EU agree to delay the Brexit deadline?

Yosemite Fire Rings - What to Expect?

why `nmap 192.168.1.97` returns less services than `nmap 127.0.0.1`?

Removing files under particular conditions (number of files, file age)

How could a planet have erratic days?

Multiplicative persistence

GraphicsGrid with a Label for each Column and Row

Is there a name for this algorithm to calculate the concentration of a mixture of two solutions containing the same solute?

Did arcade monitors have same pixel aspect ratio as TV sets?

Electoral considerations aside, what are potential benefits, for the US, of policy changes proposed by the tweet recognizing Golan annexation?

The screen of my macbook suddenly broken down how can I do to recover

What is Cash Advance APR?

Should I outline or discovery write my stories?

Should I stop contributing to retirement accounts?

Intuition of generalized eigenvector.

Why is so much work done on numerical verification of the Riemann Hypothesis?

Lowest total scrabble score

Pre-mixing cryogenic fuels and using only one fuel tank

Has any country ever had 2 former presidents in jail simultaneously?

Open a doc from terminal, but not by its name

Is it improper etiquette to ask your opponent what his/her rating is before the game?

What was this official D&D 3.5e Lovecraft-flavored rulebook?

How to bake one texture for one mesh with multiple textures blender 2.8



How to copy file from a list to a new folder?


Copy/move a list of files to a new directoryHow to separate a given type of file from others?Recursively copying filesmoving the file from one folder to another folderCopy unmatched strings in from one file to another, bulkread file names from files for command lineBash Script to Drag and Drop a File to New LocationMoving only those files that appear in the listFind, Duplicate, Rename and Copy to this foldercopying files resulting from using grep into a new folderSearch folder, find and copy files to new folder corresponding file ending













2















I have a file file1.txt located in a trial folder containing the location of image files. I want to read the list, and copy the image files to a new folder, test_folder.



The entries in file1.txt look like:



./trial/data/image1.jpg
./trial/data/image2.jpg


etc.



I tried to use a similar question to solve the problem: Copy/move a list of files to a new directory



Attempt



while read file; do cp "$file" /trial/test_folder; done < /trial/file1.txt


I get the error "bash: /trial/file1.txt: No such file or directory". Any help would be great!










share|improve this question









New contributor




Shane B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • I have updated the question to include that - thanks!

    – Shane B
    yesterday















2















I have a file file1.txt located in a trial folder containing the location of image files. I want to read the list, and copy the image files to a new folder, test_folder.



The entries in file1.txt look like:



./trial/data/image1.jpg
./trial/data/image2.jpg


etc.



I tried to use a similar question to solve the problem: Copy/move a list of files to a new directory



Attempt



while read file; do cp "$file" /trial/test_folder; done < /trial/file1.txt


I get the error "bash: /trial/file1.txt: No such file or directory". Any help would be great!










share|improve this question









New contributor




Shane B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • I have updated the question to include that - thanks!

    – Shane B
    yesterday













2












2








2








I have a file file1.txt located in a trial folder containing the location of image files. I want to read the list, and copy the image files to a new folder, test_folder.



The entries in file1.txt look like:



./trial/data/image1.jpg
./trial/data/image2.jpg


etc.



I tried to use a similar question to solve the problem: Copy/move a list of files to a new directory



Attempt



while read file; do cp "$file" /trial/test_folder; done < /trial/file1.txt


I get the error "bash: /trial/file1.txt: No such file or directory". Any help would be great!










share|improve this question









New contributor




Shane B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I have a file file1.txt located in a trial folder containing the location of image files. I want to read the list, and copy the image files to a new folder, test_folder.



The entries in file1.txt look like:



./trial/data/image1.jpg
./trial/data/image2.jpg


etc.



I tried to use a similar question to solve the problem: Copy/move a list of files to a new directory



Attempt



while read file; do cp "$file" /trial/test_folder; done < /trial/file1.txt


I get the error "bash: /trial/file1.txt: No such file or directory". Any help would be great!







command-line bash copy






share|improve this question









New contributor




Shane B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Shane B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited yesterday







Shane B













New contributor




Shane B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









Shane BShane B

133




133




New contributor




Shane B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Shane B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Shane B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • I have updated the question to include that - thanks!

    – Shane B
    yesterday

















  • I have updated the question to include that - thanks!

    – Shane B
    yesterday
















I have updated the question to include that - thanks!

– Shane B
yesterday





I have updated the question to include that - thanks!

– Shane B
yesterday










2 Answers
2






active

oldest

votes


















4














The error you are getting is because you are reading /trial/file1.txt and not ./trial/file1.txt. That means the shell is trying to find a directory called trial which is under the root directory (/). If you want a path that is relative to your current directory, you can just use:



while read file; do cp "$file" trial/test_folder; done < trial/file1.txt


Or,



while read file; do cp "$file" ./trial/test_folder; done < ./trial/file1.txt


Or, you can use the full path:



while read file; do cp "$file" /home/shane/trial/test_folder; done < /home/shane/trial/file1.txt





share|improve this answer























  • Thanks so much! That worked. I am very new to Linux so that was a great help

    – Shane B
    yesterday


















2














Another way is to use xargs and cp --target-directory=... thusly:



xargs -r <trial/file1.txt cp --target-directory=./trial/test_folder





share|improve this answer






















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    Shane B is a new contributor. Be nice, and check out our Code of Conduct.









    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1127773%2fhow-to-copy-file-from-a-list-to-a-new-folder%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    The error you are getting is because you are reading /trial/file1.txt and not ./trial/file1.txt. That means the shell is trying to find a directory called trial which is under the root directory (/). If you want a path that is relative to your current directory, you can just use:



    while read file; do cp "$file" trial/test_folder; done < trial/file1.txt


    Or,



    while read file; do cp "$file" ./trial/test_folder; done < ./trial/file1.txt


    Or, you can use the full path:



    while read file; do cp "$file" /home/shane/trial/test_folder; done < /home/shane/trial/file1.txt





    share|improve this answer























    • Thanks so much! That worked. I am very new to Linux so that was a great help

      – Shane B
      yesterday















    4














    The error you are getting is because you are reading /trial/file1.txt and not ./trial/file1.txt. That means the shell is trying to find a directory called trial which is under the root directory (/). If you want a path that is relative to your current directory, you can just use:



    while read file; do cp "$file" trial/test_folder; done < trial/file1.txt


    Or,



    while read file; do cp "$file" ./trial/test_folder; done < ./trial/file1.txt


    Or, you can use the full path:



    while read file; do cp "$file" /home/shane/trial/test_folder; done < /home/shane/trial/file1.txt





    share|improve this answer























    • Thanks so much! That worked. I am very new to Linux so that was a great help

      – Shane B
      yesterday













    4












    4








    4







    The error you are getting is because you are reading /trial/file1.txt and not ./trial/file1.txt. That means the shell is trying to find a directory called trial which is under the root directory (/). If you want a path that is relative to your current directory, you can just use:



    while read file; do cp "$file" trial/test_folder; done < trial/file1.txt


    Or,



    while read file; do cp "$file" ./trial/test_folder; done < ./trial/file1.txt


    Or, you can use the full path:



    while read file; do cp "$file" /home/shane/trial/test_folder; done < /home/shane/trial/file1.txt





    share|improve this answer













    The error you are getting is because you are reading /trial/file1.txt and not ./trial/file1.txt. That means the shell is trying to find a directory called trial which is under the root directory (/). If you want a path that is relative to your current directory, you can just use:



    while read file; do cp "$file" trial/test_folder; done < trial/file1.txt


    Or,



    while read file; do cp "$file" ./trial/test_folder; done < ./trial/file1.txt


    Or, you can use the full path:



    while read file; do cp "$file" /home/shane/trial/test_folder; done < /home/shane/trial/file1.txt






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered yesterday









    terdonterdon

    67.2k13139222




    67.2k13139222












    • Thanks so much! That worked. I am very new to Linux so that was a great help

      – Shane B
      yesterday

















    • Thanks so much! That worked. I am very new to Linux so that was a great help

      – Shane B
      yesterday
















    Thanks so much! That worked. I am very new to Linux so that was a great help

    – Shane B
    yesterday





    Thanks so much! That worked. I am very new to Linux so that was a great help

    – Shane B
    yesterday













    2














    Another way is to use xargs and cp --target-directory=... thusly:



    xargs -r <trial/file1.txt cp --target-directory=./trial/test_folder





    share|improve this answer



























      2














      Another way is to use xargs and cp --target-directory=... thusly:



      xargs -r <trial/file1.txt cp --target-directory=./trial/test_folder





      share|improve this answer

























        2












        2








        2







        Another way is to use xargs and cp --target-directory=... thusly:



        xargs -r <trial/file1.txt cp --target-directory=./trial/test_folder





        share|improve this answer













        Another way is to use xargs and cp --target-directory=... thusly:



        xargs -r <trial/file1.txt cp --target-directory=./trial/test_folder






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered yesterday









        waltinatorwaltinator

        22.7k74169




        22.7k74169




















            Shane B is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            Shane B is a new contributor. Be nice, and check out our Code of Conduct.












            Shane B is a new contributor. Be nice, and check out our Code of Conduct.











            Shane B is a new contributor. Be nice, and check out our Code of Conduct.














            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1127773%2fhow-to-copy-file-from-a-list-to-a-new-folder%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Sum ergo cogito? 1 nng

            三茅街道4182Guuntc Dn precexpngmageondP