LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   in copy files or ls files the command want to invert select some files how to?? (http://www.linuxquestions.org/questions/linux-newbie-8/in-copy-files-or-ls-files-the-command-want-to-invert-select-some-files-how-to-652010/)

hocheetiong 06-27-2008 05:52 AM

in copy files or ls files the command want to invert select some files how to??
 
Hi, in my folder have 5 files,example: 1.txt, 2.txt, 3.doc, 4.jpg, 5.cap than if i want to copy all 4 files but exclude file name "5.cap" how to issue the correct command?

if want to list files command is ls, than want to filter some files but list other file in specify folder, what is the correct command?

Thank you.

pr00t 06-27-2008 07:03 AM

Try this:

ls | grep -v 5.cap | xargs cp --target-directory=/tmp

nx5000 06-27-2008 07:29 AM

Quote:

ls | grep -v 5.cap | xargs cp --target-directory=/tmp
Should be
ls -1| grep -v "5\.cap" | xargs cp --target-directory=/tmp

unSpawn 06-27-2008 07:32 AM

...or "find directory -type something -not -iname somethingElse -exec doSomething {};"


All times are GMT -5. The time now is 11:35 AM.