I have a directory with a few dozens of files. I would like to do something with every second file from this directory. By now I only used find command but with thi
find
If you want to run my_cmd on each of the alternate file, this may help
find ./dir -type f | sort -n | sed -n '1~2!p' | sed 's/^/mycmd /' | sh
I've copied the sed from How to remove every other line with sed?