Cut sub-string and rename files use shell command -


this question has answer here:

how rename file names? want map names:

abc-hdpi.png ⟶ abc.png bcd-hdpi.png ⟶ bcd.png 

...

i have many files this, mv abc-hdpi.png abc.png not solution.

search prename (perl rename) command; can job easily:

prename 's/-hdpi.png/.png/' *-hdpi.png 

failing that:

for file in *-hdpi.png     mv "$file" "${file%-hdpi.png}.png" done 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -