I have some files named like these:
How do I rename all them to, for example 63018933.mp4(remove characters after mp4)?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
If you have the
rename(1) tool (which you do if you have Debian or a Debian-based Linux, including Ubuntu and derivatives):
rename -n 's/\.mp4.*$/.mp4/' *mp4*
Once you're convinced you have the right pattern, just remove the
-n (dry-run) and let it run properly.
rename(1) will apply a Perl regular expression to the filenames given it.
Note that on most other Linux distributions,
rename is a different file renaming program, which doesn't help for this particular renaming pattern.