Toolを作っている際、データ集合をフォルダ階層に分けて管理・Tool上にそのツリーを表示したい…などというケースは少なくないと思います。
簡単ですが、再帰処理による、「指定パス以下のフォルダ・ファイル階層を取得するmel」を作成しました。
メモ代わりに貼り付けます。
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
proc string[] GetFileListByPath(string $path){ | |
string $fileList[] = `getFileList -fld $path`; | |
string $returnList[]; | |
for($data in $fileList){ | |
$data = $path+$data; | |
if(`filetest -f $data`) $returnList[size($returnList)]=$data; | |
if(`filetest -d $data`) $returnList = stringArrayCatenate($returnList,`GetFileListByPath($data+"/")`); | |
} | |
print $returnList; | |
return $returnList; | |
} |
0 件のコメント:
コメントを投稿