Bash script, unix
Script that receives multiple arguments arg1, arg2, arg3… And renames according to swap even and odd. For example, script.sh fooA fooB food fooD fooE would rename fooA to fooB, fooC to fooD, fooE to fooF, and so on. Assume all files exist, up to 50 arguments.
Check the number of arguments first to ensure an even amount of arguments.
Have rename.txt in the same directory as your files exist.
where rename.txt contain only pairs of
on each line.
Run this command
eval “$(sed ‘s/^/mv /g’ rename.txt )”
sed is used to convert your rename_rules into mv oldname newname
eval is then used to execute it, thus the file gets renamed