Created
April 27, 2017 05:33
-
-
Save marhan/82aca093ac8e8b8724270f00df4320ab to your computer and use it in GitHub Desktop.
Extract file name and its extension from absolut file path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
full_file_path="/PATH/test.csv" | |
# complete file name without path | |
file_name="${full_file_path##*/}" | |
# file name without extension | |
file_name_part="${full_file_path%.*}" | |
# extension of file | |
file_extension="${full_file_path##*.}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment