Scratchpad

Iteration in bash

(, , — )

4 Jan. 2008

I'm a terrible programmer, mainly because I only try to do it when I really need something, instead of just sequestering myself in a room with cheesy puffs and Dr. Pepper for 2 weeks to just do it already. So I find myself having to keep notes when I do anything successfully lest I forget when I need to program again 6 months later. Even the really, really simple shit. Sigh.

Changing file names quickly in a Linux directory with a billion files:


for i in $(ls -1 s_*.gif);
do (( n++ )); mv $i file$n.gif ;
done

No Comments

No comments yet.

RSS feed for comments on this post. ||

Leave a comment