PDA

View Full Version : How do you get the name of the folder your in?


Springbov
December 21st, 2005, 05:07 PM
On windows everything I've tryed to figure out the name of the folder your in hasnt worked out to good.
and when I mean the name of the folder I dont mean C:/documents and settings/someguy/my documents/the_folder_I'm_trying_to_target
I only want
/the_folder_i'm_trying_to_target(aka the current active directory)

rob
December 22nd, 2005, 02:55 AM
File.expand_path(".")

This gives you the current full path. If you take this and either parse it with a regex or subtract a known value you can end up with what you need.

Hope this helps.