Why the command line can be better

I have an online photo album that, when a file is uploaded, will create a thumbnail size and an intermediate sized photo along with the full size version. I needed to copy the full size version of the file out while skipping the thumb and sized versions. I was able to accomplish this task using a single command:

[root@drue Wedding]# for I in `ls | grep -v sized | grep -v thumb`; do cp $I /var/www/html/pics/; done

This would have taken a lot longer using any other method. Using a GUI, say, Windows Explorer, I’d still be selecting which files to copy by the time the above command completed the work.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.