I was going to write a php function to do this for myself, but I came across a faster method:
ls and copy and paste the contents of the directory into excel from the terminal window. You may need to use a tool to delete or delete online strings . Suppose your file names are in column A in excel, use the following formula in another column:
="mv "&A1&" prefix"&A1&"suffix"
or
="mv "&A1&" "&substitute(A1,"jpeg","jpg")&"suffix"
or
="mv olddirectory/"&A1&" newdirectory/"&A1
back to Linux, create a new file with nano rename.txt and paste the values from excel. They should look something like this:
mv oldname1.jpg newname1.jpg mv oldname1.jpg newname2.jpg
then close nano and run the following command: bash rename.txt . Bash simply runs every line in the file, as if you typed it.
and you're done! This method gives a detailed error output, which is convenient.
source share