Is there a simple way to get the name of the current folder name or do I have to do it with regexp?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
File.basename()returns the base name even when its argument is the path of a directory.The following code prints kiamlaluno for me, where /home/kiamlaluno is the home directory in my Ubuntu installation.
The same does
puts File.basename(Dir.getwd), when the current directory is /home/kiamlaluno.