Welcome Guest ( Log In | Register )




                Web Hosting Guide

 
Reply to this topicNew Topic
File Rename Script, Sentence, Large collection of files to rename!
bakr_2k5
post Dec 6 2006, 04:49 PM
Post #1


Member - Active Contributor
Group Icon

Group: Members
Posts: 83
Joined: 25-September 06
From: The Netherlands
Member No.: 16,153


Hello there,

Today I've encoded lots of mp3's for my portable mp3 player (which only has 128mb ... blink.gif), 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 mellow.gif. 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? smile.gif
Of 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 wink.gif

(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 huh.gif. Thank you!)

Bakr_2k5

This post has been edited by bakr_2k5: Dec 6 2006, 04:50 PM
Go to the top of the page
 
+Quote Post
Mark420
post Dec 6 2006, 05:23 PM
Post #2


The Modernator
Group Icon

Group: Members
Posts: 486
Joined: 6-August 06
From: The Interweb!
Member No.: 15,021


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)
Go to the top of the page
 
+Quote Post
bakr_2k5
post Dec 6 2006, 07:11 PM
Post #3


Member - Active Contributor
Group Icon

Group: Members
Posts: 83
Joined: 25-September 06
From: The Netherlands
Member No.: 16,153


QUOTE(Mark420 @ Dec 6 2006, 07:23 PM) [snapback]93317[/snapback]

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 wink.gif) 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[/console]And it works smile.gif 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 smile.gif

Bakr_2k5

This post has been edited by bakr_2k5: Dec 6 2006, 07:13 PM
Go to the top of the page
 
+Quote Post
qwijibow
post Dec 8 2006, 01:30 PM
Post #4


Way Out Of Control - You need a life :)
Group Icon

Group: Members
Posts: 1,366
Joined: 14-September 04
From: Nottingham England
Member No.: 570



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.

Go to the top of the page
 
+Quote Post
bakr_2k5
post Dec 8 2006, 02:59 PM
Post #5


Member - Active Contributor
Group Icon

Group: Members
Posts: 83
Joined: 25-September 06
From: The Netherlands
Member No.: 16,153


QUOTE(qwijibow @ Dec 8 2006, 01:30 PM) [snapback]93449[/snapback]

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?[/console]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 wink.gif), to do these things!

Bakr_2k5

This post has been edited by bakr_2k5: Dec 8 2006, 03:00 PM
Go to the top of the page
 
+Quote Post
nightfox
post Dec 9 2006, 03:14 AM
Post #6


NiGHTFoX - Hiding in the dark
Group Icon

Group: Members
Posts: 680
Joined: 3-April 05
Member No.: 3,584


QUOTE(qwijibow @ Dec 8 2006, 08:30 AM) [snapback]93449[/snapback]

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!! laugh.gif Doesn't have to be "open" source... take IPB. Not open source, but the source code is available for modifications!

[N]F
Go to the top of the page
 
+Quote Post
borlafu
post Dec 10 2006, 11:27 PM
Post #7


Member [ Level 2 ]
Group Icon

Group: Members
Posts: 58
Joined: 9-November 06
Member No.: 17,133


QUOTE(qwijibow @ Dec 8 2006, 02:30 PM) [snapback]93449[/snapback]

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:
CODE
man rn
Go to the top of the page
 
+Quote Post
vujsa
post Dec 11 2006, 04:19 AM
Post #8


Absolute Newbie
Group Icon

Group: Admin
Posts: 888
Joined: 20-February 05
From: Indianapolis, Indiana, USA (Midwest)
Member No.: 2,714
myCENTs:35.43


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://www.handyphp.com/component/option,c...d,14/Itemid,25/

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

I hope this helps. cool.gif
vujsa
Go to the top of the page
 
+Quote Post

Reply to this topicNew Topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts  
4 PHP
8 bluefish 3,131 16th March 2010 - 02:01 PM
Last post by: iG-op
No New Posts   18 vicky99 7,575 24th February 2010 - 08:16 PM
Last post by: iG-ivmai
No New Posts 7 Niru 4,454 20th February 2010 - 07:04 AM
Last post by: iG-suresh
No New Posts   5 jackpinerepublic 4,390 19th February 2010 - 02:04 AM
Last post by: iG-Simon Varley
No new   19 Feelay 9,186 18th February 2010 - 08:47 AM
Last post by: iG-Tsholofelo
No New Posts   17 rapco 9,923 12th February 2010 - 06:48 AM
Last post by: iG-Sanjaya
No New Posts   15 PureHeart 11,907 10th February 2010 - 08:02 PM
Last post by: iG-khadeer
No New Posts   14 jedipi 7,765 10th February 2010 - 05:47 PM
Last post by: iG-keith
No New Posts   10 Eggie 8,445 10th February 2010 - 06:47 AM
Last post by: iG-
No New Posts   12 Nqon 4,595 9th February 2010 - 02:46 PM
Last post by: iG-
No new   22 muazamali 8,903 9th February 2010 - 04:18 AM
Last post by: topboys
No New Posts   14 bob3695 10,096 8th February 2010 - 09:19 PM
Last post by: iG-Manish Patel
No New Posts   6 Skepticus 188 7th February 2010 - 02:16 AM
Last post by: 8ennett
No new 21 miCRoSCoPiC^eaRthLinG 1,990 4th February 2010 - 05:29 PM
Last post by: 8ennett
No New Posts   5 Jeigh 3,637 3rd February 2010 - 07:16 PM
Last post by: iG-Juan


Web Hosting Powered by ComputingHost.com.
HONESTY ROCKS! truth rules.
Creative Commons License