You would need to maintain the iteration separately. For example, use a script move_count
containing the following:-
[ -w ~/MoveCount ] || echo 0 >~/MoveCount read count <~/MoveCount ((++count)) echo $count >~/MoveCount mv "$1" "$count.$"
Then your find
command would become:
find -iname "*.jpg" -exec bash -c "move_count {}" \;
Note that bash
is called explicitly because the default sh
doesn't understand some of the syntax I have used. Alternatively, make #!/bin/bash
the first line of move_count
.