Created
October 17, 2017 17:02
-
-
Save devuri/a41496d1cf1fc14bdfc9b0b472d7d7d1 to your computer and use it in GitHub Desktop.
remove last 12 characters of a file name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| You could use rename. From inside the directory: | |
| rename -n 's/(.*).{12}/$1/' * | |
| Remove -n after testing to actually rename the files. Replace {12} with {whatever number of characters you want to delete from the end of the name} | |
| Explanation | |
| s/old/new/' replaceoldwithnew` | |
| (.*) save any number of any characters... | |
| .{12} the last twelve characters whatever they are | |
| $1 the characters saved with () | |
| // credit | |
| //https://askubuntu.com/questions/873617/remove-last-n-characters-of-filenames-in-a-directory |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment