LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-03-2005, 01:01 AM   #1
carl0ski
Member
 
Registered: Sep 2004
Location: Melbourne, Victoria Australia
Distribution: Support those that support you :)
Posts: 872
Blog Entries: 12

Rep: Reputation: 30
Invert to Basename strip filename


hi i'm hoping to remove a filename from a filename path

dcop amarok player path
displays
/mnt/music/Complete albums/Green Day - Unplugged/Green Day - 07 - When I Come Around.mp3

'basename "$(dcop amarok player path)"
strips the folder and displays
Green Day - 07 - When I Come Around.mp3



but i'm hoping to strip it to this for a amarok script
/mnt/music/Complete albums/Green Day - Unplugged/

and hopefully take capture just the extension also

the spaces in the directory has complicated things little for me

cp "$(dcop amarok player path)" "/mnt/music/Complete albums/Green Day - Unplugged/"0"$(dcop amarok player track)"\ -\ "$(dcop amarok player artist)"\ -\ "$(dcop amarok player title)".mp3


#copy/rename playing track in format track - artist - title.extension
 
Old 07-03-2005, 02:23 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Not sure to get your request, but maybe what you want is "dirname".
 
Old 07-03-2005, 02:36 AM   #3
carl0ski
Member
 
Registered: Sep 2004
Location: Melbourne, Victoria Australia
Distribution: Support those that support you :)
Posts: 872

Original Poster
Blog Entries: 12

Rep: Reputation: 30
lol i did it :P

cp "$(dcop amarok player path)" "$(dirname "$(dcop amarok player path)")"/0"$(dcop amarok player track)"\ -\ "$(dcop amarok player artist)"\ -\ "$(dcop amarok player title)".mp3

renames files in amarok based on Tags.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Invert mouse in OS jakob_g Linux - Newbie 1 09-06-2005 10:25 AM
invert colors rksprst General 4 06-24-2005 10:31 PM
iptables invert issue lappen Linux - Software 8 09-26-2004 02:19 PM
terminal colors invert gkhattak Linux - Newbie 0 08-29-2002 09:42 PM
basename counterpart? glass Linux - General 1 08-24-2002 06:11 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration