[SOLVED] Running a python script on multiple files
*BSDThis forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hey guys. I'm trying to run a python script that was created to reencode mp3 files. When I run the script on one mp3I have no problem but I can't figure out why it's not outputting multiple files. Terminal acts like ts doing something but no files are being created in the folder I specify.
I'm running:
because I have about 200 mp3s in the folder, and the random is because the mp3s currently are named in numbers and I'll have to figure out the rest later, for now I just want them encoded.
Any ideas what is wrong with what I'm putting?
Last edited by ManyouRisms; 05-26-2011 at 12:47 PM.
Reason: Code didn't post properly
@archtoad6. Nothing particularly special about the script but afaik the problem isn't with the script it's how I'm running it via command line,which is why I put it here. I understand if yo want to move it though, my apologies.
@kbp thanks a lot I'll give it a go now and post back.
Edit: Okay I've done
cd /var/mobile/Library/Downloads/Music/
for files in [ "${1##*.}" = "mp3" ]
do
** *nice -20 python /var/mobile/decrypter.py /var/mobile/Library/Downloads/Music/*.mp3 $file
done
What it does is take one file and reencode it but in place instead of a encoded copy. Not sure where else to go with this.
Last edited by ManyouRisms; 05-27-2011 at 05:59 PM.
Reason: Updates
far out, this seems to be working a treat. i forgot by using ´for file in´ i was defining $file so i didnt need the *.mp3. thanks a lot guys, i´m just starting to have a bit of fun with this so hopefully i can make it through the rest of my ebooks.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.