------------------------------------------------------------------------------- File Renaming -- it is not a simple as it seems! ------------------------------------------------------------------------------- Lots of programs are available to use... --- "mved" is a shell script basied on sed. https://antofthy.gitlab.io/software/#mved mved =.01 = Script works, but is a little kludgy in some situations due to the messy conversions into sed regular expressions. It is however simple and easy to use in most situations, compared to other solutions below. --- "mv_perl" https://antofthy.gitlab.io/software/#mv_perl mv_perl 's/\.01$//' *.01 This perl solution also allows you to apply very complex formulas... For example this will reformat ALL the numbers in a filename to width $w with leading zeros (using "sprintf()" ). mv_perl 's/\d+/sprintf "%0*d", $w, $&/eg' *[0-9]* Many formulas are pre-defined in the command, and can be accessed by renaming (or symlinking) the script to matching names. For example the above formula can be used if you rename (symlink) the script so it is called as "mv_renum". --- "mv_renum" https://antofthy.gitlab.io/software/#mv_renum A more controlled version to the previous perl one (above) for handling numbers in filenames. Basically it will let you replace the first or last number in the filenames (-l for last). If renamed to "mv_reseq" it will resequence the numbers, with controls the start and increment of the numbering, and can even reverse the numerical order of the files. The script ensures than numbers do not clash or overwrite each other. If there is a filename clash, it initially assumes that file will be renamed later, and will leave it to try again later to see if the destination file was renamed. This is especially important when incrementing numbers by 1 or reversing the sequence. --- "rename" There is a perl version (ubuntu) like "mv_perl" above rename 's/\.01$//' *.01 But there is also a "util-linux" version (pure string replacement) Which is installed on fedora and redhat machines. rename .01 '' *.01 Because of this multiple version clash, using "rename" script is NOT recommended. ------------------------------------------------------------------------------- DIY File renaming... A bash solution (Remove ".01" from filename... for i in *.01; do mv "$i" "${i%%.01}"; --- For a whole directory it can be easier to create a script in vim ls > files.txt vi files.txt :%s/.*/mv -i & &/g :%s/.JPEG$/.jpg/g :wq # the resulting shell script can be visiually checked! bash files.txt --- vidir - edit directories and filenames Small program to place a numbered directory of filenames in vim. You can edit the filenames and on exit it will rename all files as you have edited, linking new names names using the reference number in the file. --- vim-rename A older directory editor like "vidir". https://github.com/qpkorr/vim-renamer --- Vim File Explorer vim {directory} 'R' to rename 'D to delete I find it a bit clunky. --- For a single name.. you can replace the "mv" command with a bash function that lets you edit a filename, if only one argument is given. function mv() { if [ "$#" -ne 1 ] || [ ! -e "$1" ]; then command mv "$@" return fi read -ei "$1" newfilename command mv -v -- "$1" "$newfilename" } From https://www.ostechnix.com/ bash-tips-rename-files-without-typing-full-name-twice-in-linux/ -------------------------------------------------------------------------------