Remove first n character from bunch of file names with cut Remove first n character from bunch of file names with cut bash bash

Remove first n character from bunch of file names with cut


rename -n 's/.{5}(.*)/$1/' *

The -n is for simulating; remove it to get the actual result.


you can use the following command when you are in the folder where you want to make the renaming:

rename -n -v  's/^(.{5})//' *

-n is for no action and -v to show what will be the changes. if you are satisfied with the results you can remove both of them

rename 's/^(.{5})//' *


Something like this should work:

for x in *; do    echo mv $x `echo $x | cut -c 5-`done

Note that this could be destructive, so run it this way first, and then remove the leading echo once you're confident that it does what you want.