Published on Oct 29, 2003, 10:00 PM1 min read

I know I havn't been posting much recently, and its been a combo of being sick, being depressed, and .. well.. nothing of interest coming up. But i'm going to try and fix that with some interesting posts.

Yea, today was the first day I ever actually looked at the xargs man page.

I was trying to figure out how to use mv with xargs. I learned so much today. Did you know that xargs doesn't actually pass them all in like a big long string? NOOO, it runs it multple times.

For Example, find ./ | grep jpg might return:




If you run find ./ | grep jpg | xargs -i mv {} pictures/ (which happends to be the proper syntax :D) will run:

mv ./gavin1.jpg pictures/

mv ./gavin2.jpg pictures/

mv ./gavin3.jpg pictures/

Which is both good and bad, good that it works, and doesn't have absurdly long file lists (which was the problem i was having, find was returning almost 1500 jpegs), bad if the program you are running (mv in this case) takes a huge amount of time to start/do its work when it might be better to pass in the entire file list :)

Thats my info for the day

Gavin Mogan
Burnaby, BC, Canada

I'm Gavin.

I'm a tinker, maker, and software developer.

At home I code, game, hang out, all the cool non robot things to do.

Heavily involved with Jenkins open source, and will often submit PRs to random other projects.

I also play games, both board and video games and love to read.

You can usually find me on various services as halkeye.