Friday 1 February 2019

Bash command batch for renaming files without prefix


This line renames all files in a directory to remove the front of their names up to and including the first underscore character.
e.g.:
1242_file.txt
1209_another_file.txt
99_red balloons.wav

~becomes~

file.txt
another_file.txt
red balloons.wav


for i in *; do mv "$i" "`echo "$i" | sed 's/^[^_]*_//'`"; done

No comments:

Post a Comment

  Azure Trusted Signing Signtool Error SignTool Error: An unexpected internal error has occurred. Error information: "Error: SignerSign...