I have a list of filenames called list.txt.
I would like to copy the files in this list to a new folder.
How should I go about doing this?
Thanks!
To list files in a terminal, you use the ls command to list all files in the current directory. The pwd commands tells you what directory you're currently in.
To copy multiple files you can use wildcards (cp *. extension) having same pattern. Syntax: cp *.
Right-click that folder and select Show more options. Click Copy File List to Clipboard on the classic menu. You'll still need to paste the copied list into a text file. Launch Run, type Notepad in the Open box, and click OK.
You can do this:
cp `cat list.txt` new-folder/
Note that you should avoid having spaces in your filenames when using this (another solution would be needed if this is the case).
The backticks execute the cat list.txt
command and use the output of that command as part of the command line to cp
. Newlines in the output of cat
are collapsed to spaces before command line substitution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With