現行ディレクトリの親ディレクトリを与える.
ParentDirectory["dir"]
ディレクトリ dir の親ディレクトリを与える.
ParentDirectory["dir",n]
dir から n レベル上のディレクトリを与える.
ParentDirectory
現行ディレクトリの親ディレクトリを与える.
ParentDirectory["dir"]
ディレクトリ dir の親ディレクトリを与える.
ParentDirectory["dir",n]
dir から n レベル上のディレクトリを与える.
詳細
- ParentDirectoryは,列としてディレクトリのフルネームを返す.
- ParentDirectory[n]は,n が整数のときは,現行のディレクトリから n レベル上のディレクトリを与える.
- ParentDirectory[File["dir"],…]もサポートされている.
例題
すべて開く すべて閉じる例 (3)
$InstallationDirectoryの親ディレクトリを求める:
$InstallationDirectoryの2レベル上のディレクトリを求める:
スコープ (3)
Fileオブジェクトで指定されたディレクトリの親ディレクトリを得る:
特性と関係 (4)
ParentDirectory[dir]の dir はディレクトリとして存在しなければならない:
ParentDirectoryは常に完全パスを返す:
ParentDirectory[1]はParentDirectory[]に等しい:
ParentDirectoryは既存のディレクトリにのみに働き,完全パスを返す:
FileNameDropは,純粋にテキストのレベルで,同様のパス操作を行う:
テクニカルノート
-
▪
- ファイル名と検索
関連するガイド
-
▪
- ディレクトリとその操作 ▪
- ファイル名の操作
関連するワークフロー
- プログラムでファイルパスを構築する
履歴
1991 で導入 (2.0) | 2016 で更新 (11.0) ▪ 2017 (11.2)
テキスト
Wolfram Research (1991), ParentDirectory, Wolfram言語関数, https://reference.wolfram.com/language/ref/ParentDirectory.html (2017年に更新).
CMS
Wolfram Language. 1991. "ParentDirectory." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017. https://reference.wolfram.com/language/ref/ParentDirectory.html.
APA
Wolfram Language. (1991). ParentDirectory. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ParentDirectory.html
BibTeX
@misc{reference.wolfram_2025_parentdirectory, author="Wolfram Research", title="{ParentDirectory}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/ParentDirectory.html}", note=[Accessed: 02-April-2026]}
BibLaTeX
@online{reference.wolfram_2025_parentdirectory, organization={Wolfram Research}, title={ParentDirectory}, year={2017}, url={https://reference.wolfram.com/language/ref/ParentDirectory.html}, note=[Accessed: 02-April-2026]}