Jump to content
xisto Community
Sign in to follow this  
bakr_2k5

File Rename Script, Sentence Large collection of files to rename

Recommended Posts

Hello there,Today I've encoded lots of mp3's for my portable mp3 player (which only has 128mb ... :P), Anyway I encoded them with Lame using mlame script (for those don't know it handles more files then one).Now mlame appends "-new-converted-file" to the filename. And renaming every individual file with the hand is A LOT of work :P. I tried to write a script to remove that "-new-converted-file" but they kinda all failed! And the "tr" command seems it can't handle sentences.Well does anyone in here have a clue or a nice script to do this? :POf course if you only give me a hint to do this. I'll write the script on my own. But if you feel like, you're free to do it :P(Please no reply about use "sed" or something like that without some explanation, I really don't know anything about it. And I just can't understand the whole "sed" thing :P. Thank you!)Bakr_2k5

Edited by bakr_2k5 (see edit history)

Share this post


Link to post
Share on other sites

I can point you to the right direction I hope..I would use a lightweight PERL script to do this..its perfect for the job!Google up some cool PERL scripts and I am sure you will find one that can rename/replace etcGood Luck!Markyl)

Share this post


Link to post
Share on other sites

I can point you to the right direction I hope..I would use a lightweight PERL script to do this..its perfect for the job!
Google up some cool PERL scripts and I am sure you will find one that can rename/replace etc

Good Luck!

Markyl)

Searched for while for PERL scripts, but the all seem web orientated or CGI stuff. So no real use.
But I just discovered a standard linux program (at least I think it's standard :P) called "rename".
Very oblivious, well my topic lately are a bit lame guess I need more sleep... Anyway I just do this:
CONSOLE
rename -new-converted-file.mp3 .mp3 *.mp3
And it works :P So problem solved, and thank you Mark420 for your reply!

Think I'm going to work on a script for Nautilus (gnome's file manager) to integrate this stuff :P

Bakr_2k5
Edited by bakr_2k5 (see edit history)

Share this post


Link to post
Share on other sites

1)I would be very surprised if there wasnt a parametr you could pass to the script to cause it NOT to add that string to the file name.2)You Have the source code !!!Edit the Script.Is this not the reason we love open source ???if it doesnt do exactly what you want it to... re-program it.

Share this post


Link to post
Share on other sites

1)

I would be very surprised if there wasnt a parametr you could pass to the script to cause it NOT to add that string to the file name.

 

2)

You Have the source code !!!

Edit the Script.

Is this not the reason we love open source ???

if it doesnt do exactly what you want it to... re-program it.

 

Answer to 1:

No there isn't some kind of parameter in mlame or lame itself!

CONSOLE
This script runs the LAME mp3 encoder on multiple files:

 

/usr/bin/mlame [options] <file 1> ... <file n>

 

options:

-? this help text

-r remove files after encoding

-f force overwrite of destination if exists

-l low quality settings

-h high quality settings

-o "<lame options>" overrides script default options

 

example:

/usr/bin/mlame -r -f -o "-v -V 0 -b 112" a*.wav z*.aif g*.mp?

And have tried all those parameters and none did the thing I wanted!

 

Answer to 2:

Yes you're completely right, but I don't consider myself a good programmer. I know some basics but none of the advanced stuff (soon it will come). Perhaps I'm a bit to faint-hearted (got that word from babelfish :P), to do these things!

 

Bakr_2k5

Edited by bakr_2k5 (see edit history)

Share this post


Link to post
Share on other sites

2)You Have the source code !!!
Edit the Script.
Is this not the reason we love open source ???
if it doesnt do exactly what you want it to... re-program it.

Amen to that!! :P Doesn't have to be "open" source... take IPB. Not open source, but the source code is available for modifications!

[N]F

Share this post


Link to post
Share on other sites

2)You Have the source code !!!
Edit the Script.
Is this not the reason we love open source ???
if it doesnt do exactly what you want it to... re-program it.


Anyway I think he's not going to fix and recompile the program, and then reencode the songs just to change their name...

Take it easy:
man rn

Share this post


Link to post
Share on other sites

Well, I just couldn't resist getting involved. I just spent the last 2 hours writting a script to do this for you.

It is PHP based and you may have to move your files to your web root to work but it will strip all of the unwanted formating from your filenames.

In linux, you may also need to change the file permissions to do the rename.

The script is completely insecure and needs to be placed in a secure location such as a password protected directory. Failure to secure this script will give anyone with public access to your system the ability to rename ALL of your files. This is a very dangerous script if use improperly.

The script may be found here:
http://forums.xisto.com/no_longer_exists/

Registration is required for download, sorry. I do this to prevent excessive automated downloading by theft bots etc...

I hope this helps. :P
vujsa

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.