1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

basenameコマンドの使い方(fileの抽出方法)

Posted at

basenameはファイル名やディレクトリパスを利用してファイル名やディレクトリ名を抽出するコマンド。拡張子を抽出しないことも可能。

##挙動

###ファイルをとりだす

$basename path_name 

####例

$basename User_name/Desktop/projects/file.xml

###拡張子なしのファイルをとりだす

$basename path_name extension_name

####例

$basename User_name/Desktop/projects/file.xml .xml

つまり、拡張子を取り出したくない場合は、拡張子を語尾にかく!

動作原理としては、パスの一番右の部分を抽出している。

以上です:)

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?