Ubuntu 16.04
I'm pretty new to linux and have a large number of files an the directory dir. These files have postfix _uploaded.
Is there a way to rename all this files and set them postfix _handled instead of _uploaded?
Ubuntu has rename (prename), from directory dir:
rename -n 's/_uploaded$/_handled/g' -- *_uploaded
-n is for --dry-runAfter getting the potential changes to be made, remove n for actual action:
rename 's/_uploaded$/_handled/g' -- *_uploaded
You can also leverage bash parameter expansion, within a for loop over the filenames containing the string _uploaded at the end, from directory dir:
for f in *_uploaded; do new=${f%_uploaded}; echo mv -- "$f" "${new}_handled"; done
This will show you the changes to be made, remove echo for actual action.