かなり前の記事ですが、
ディレクトリ下の全ファイルパスを取得
http://hsp.tv/play/pforum.php?mode=pastwch&num=6015
こちらの記事のNO.6064
kz3様のスクリプトを参考に組んでみました。
参考スクリプトはフォルダ名のみですのでファイル名も取得するように改造してあります。
↓考えたスクリプト
#include "hspda.as" sdim now_dir, 260 // フォルダ取得用 sdim now_file, 260 // ファイル取得用 chdir "E:" g_list = dir_cur + "\n" // フォルダ一覧 g_folder_cur = 0: g_folder_max = 1 // フォルダの現在値 / 最大数 objsize ginfo_winx, ginfo_winy // 結果表示用 listbox chk_list, 0, g_list // フォルダ一覧の取得 repeat // 取得する一覧がなくなったら終了 if ( g_folder_max == g_folder_cur ) : break // 一覧の中から順次フォルダを取り出して掘り進める notesel g_list noteget now_dir, g_folder_cur //if ( instr(now_dir,0,"\\\\") != -1 ) :g_folder_cur++: continue // VOLUMEなんとかファイルで\\という文字列が出る?? chdir now_dir g_folder_cur++ // カレントディレクトリのフォルダ一覧を取得 dirlist s_list, "*.*", 5 ret = stat: g_folder_max += ret // 取得したカレントディレクトリのフォルダを一覧に追加 if ret { notesel s_list repeat ret noteget now_file, cnt g_list += dir_cur + "\\" + now_file + "\n" loop } loop ; 一覧更新 objprm 0, g_list sdim _filelist,1024 sdim filelist,65536*8 notesel g_list repeat notemax notesel g_list noteget dir,cnt dirlist _filelist,dir+"\\*.*",3 notesel _filelist repeat notemax noteget filename,cnt filelist += dir+"\\"+filename+"\n" loop loop filelist += g_list sortnote filelist objprm 0,filelist notesel filelist title "Fin : アイテム数 : "+notemax+"個" stop
検証においてはEドライブを対象としています。
6行目の
chdir "E:"
こちらを
chdir "E:\\hogehoge"
等と指定すると問題無く動くのですが、
chdir "E:"のようにドライブ全体を指定するとうまく動きません。
これは、システムフォルダなどが出てくるとうまく取得できないのでしょうか?
また、chdir "E:\\"と記述することと、chdir "E:"と記述することの違いなど、教えて頂けると有り難いです。
以上、よろしくお願い致します。