Skip to main content

Thread: How to rename multiple files with only parts of the original name in the new name


hi,

me find way rename file different name containing parts of old name?

example:

original file name: filename1.abc.xyz.some.other.stuff
final file name: filename1.abc.xyz

length of file name not constant
abc.xyz not constant format (three numbers.three numbers)
.some.other.stuff not constant , want rid of

appreciated.

thank you!

hiya. maybe create script operation:

code:
#!/bin/sh    files=`ls /path/to/files/`      oldfilename in $files ;     newfilename=`echo $oldfilename | sed "s/\(.*\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]\)\..*/\1/"`   echo $newfilename    done
if works, replace "echo $newfilename" "mv $oldfilename $newfilename"


Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [SOLVED] How to rename multiple files with only parts of the original name in the new name


Ubuntu

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts