Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Feb 052010

Remove directory name from file path


It is easy to use basename to remove directory name from file path


# basename /tmp/test.txt

# basename /tmp/test.txt .txt

If you supply the 2nd argument, it will remove the characters if they exist in the suffix of the input filename.

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>