#!/bin/ksh echo "Print the full file name" full_file_name="/usr/local/data/filename.txt" echo ${full_file_name} echo echo "Find just the name of the file" file_name=`basename ${full_file_name}` echo ${file_name} echo echo "Find just the name of the directory" dir_name=`dirname ${full_file_name}` echo ${dir_name} echo echo "Strip off the extention .txt" name=${file_name%.txt} echo ${name} # OUTPUT: # # Print the full file name # /usr/local/data/filename.txt # # Find just the name of the file # filename.txt # # Find just the name of the directory # /usr/local/data # # Strip off the extention .txt # filename