|
|
|
|
|
by m463
2019 days ago
|
|
My way is: Try to write small loops and pipes on the command line.
I do things like this all the time: for i in foo*.txt; do mv $i OLD-$i; done
You'll find this breaks sometimes, so use control-r to recall the command and fix it for i in foo*.txt; do mv "$i" "OLD-$i"; done
if it gets too long, copy/paste it into a file like ~/bin/renamer and multiple lines and indenting and make it a more permanent part of your collection.Also, shell isn't the end. I move to python when shell scripts get cumbersome. python can easily parse arguments (argparse), handle filenames with weird characters in them (os.path), walk trees of files (os.walk) and more. |
|