LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to copy some files that have same first part? (https://www.linuxquestions.org/questions/linux-general-1/how-to-copy-some-files-that-have-same-first-part-4175493972/)

massy 02-06-2014 03:25 PM

How to copy some files that have same first part?
 
I used:
Code:

cp while* DEST
to copy some files that start with while,but the command treats it as a full name of a file

suicidaleggroll 02-06-2014 03:37 PM

Are you sure there are files that match "while*"? What if you run "ls while*"?

The shell will expand your "while*" before it calls cp, assuming that there's anything to expand to. If there's not, then cp gets the literal "while*" and will throw an error if it doesn't exist.

Code:

$ ls while*
ls: cannot access while*: No such file or directory
$ touch whilea whileb whileyay
$ ls while*
whilea  whileb  whileyay

cp works the same way


All times are GMT -5. The time now is 01:39 AM.