You are not logged in.
Pages: 1
Topic closed
I have some .png file and I need to remove from all of them a filename part containing '.mdl' (this is not an extension). I tried running a find command
find . -type f -exec rename 's/\ \(.mdl\)$//' {} \;
but it tells me there is not enough arguments.
Last edited by Lockheed (2012-08-06 11:58:13)
Offline
why using find ?
rename ".mdl" "" *
https://balaskas.gr
Linux System Engineer - Registered Linux User #420129
Offline
Correct. Also, your first attempt failed for two reasons, the first being your use of sed syntax , the second being that rename requires three arguments, not two. rename -h helps here.
Offline
why using find ?
rename ".mdl" "" *
Lol. KISS. Thanks.
Offline
For recursive renaming in multiple folders:
$ cd /parent/folder
$ rename ".mdl" "" */*
Don't forget to mark it as solved.
I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).
Offline
For recursive renaming in multiple folders:
$ cd /parent/folder $ rename ".mdl" "" */*
No, you need globstar (**)
shopt -s globstar
rename ".mdl" "" **.png
Offline
No, you need globstar (**)
shopt -s globstar rename ".mdl" "" **.png
I had no idea about globstars. MY WHOLE LIFE HAS BEEN TURNED UPSIDE DOWN
...Another option I learned about kind of recently is "vidir", found in the "moreutils" package. It's like using vim on a directory!
Offline
I had the same problem... and at last I found WHY.
The command "rename" in Archlinux is different from the command "rename" in Debian/Ubuntu.
If you want to use "rename <perl replacement> file..." in Archlinux then install the package "perl-rename", and run "perl rename <perl replacement> file..."
Offline
That information would be better placed on the wiki, rather that a three year old solved thread.
Please don't necrobump.
Closing.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Pages: 1
Topic closed