Rob Hudson wrote:

Given a variable with something like this in it:
/Volumes/Projects/Testing/Simple_Carbon_App.pkg

I need to extract the base path to get:
/Volumes/Projects/Testing


basename will give you the name of the file, and dirname will give you the path:

$ basename /Volumes/Projects/Testing/Simple_Carbon_App.pkg
Simple_Carbon_App.pkg

$ dirname /Volumes/Projects/Testing/Simple_Carbon_App.pkg
/Volumes/Projects/Testing

Further, if you give basename an extension to strip, it does that too:

$ basename /Volumes/Projects/Testing/Simple_Carbon_App.pkg .pkg
Simple_Carbon_App

Note that you must include the period, or it includes that in the results.

Russ
_______________________________________________
EUGLUG mailing list
euglug@euglug.org
http://www.euglug.org/mailman/listinfo/euglug

Reply via email to