LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Ls-command question (https://www.linuxquestions.org/questions/linux-newbie-8/ls-command-question-4175531469/)

pan64 01-19-2015 09:06 AM

what about just: mv *.jpg ~/images/wallpapers/shared
that should work
I think you miss a very important point: * will be evaluated by the shell, before executing the command (whatever command is it), and therefore the shell will create the list you need.
ls, the command, will only format or sort the result (and grep is a filter)....

Miati 01-19-2015 09:29 AM

Please do not use ls to pipe to commands!

It is not stable enough to be trusted. e.g., ls picture folder/ will output picture folder/ (two arguments, picture file & folder/)
I'm pretty sure globbing is what you're trying to do (as mentioned before) and will handle unusual filenames much better.
Remember, linux is case-sensitive.

* means any or all characters expanded - or everything (sometimes file/folders starting with . are not included)
*jpg means anything that ends with jpg - e.g. image.jpg
file_* means anything that starts with file_ - e.g. file_3002
file_*jpg means anything that starts with file_ and ends with jpg - e.g. file3002.jpg

A trick, */ will list all directories. (All directories end in / right? images/)

Try echo /* to see everything in your root directory.


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