Skip to content

Instantly share code, notes, and snippets.

@10sr
Created February 16, 2010 16:22
Show Gist options
  • Save 10sr/305643 to your computer and use it in GitHub Desktop.
Save 10sr/305643 to your computer and use it in GitHub Desktop.
ディレクトリのファイルリストを相対パスでindex.htmlに生成
#NoTrayIcon
p = %1%
if ( p = "-a" )
{
IfExist, %2% ;%2% exist
SetWorkingDir, %2%
else
{
goto dirnotfound
}
}
else
{
msgbox,1,,%1%のサブフォルダ内を含む全てのindex.htmlを確認なしに上書きします。`n心の準備はいいですか?
IfMsgBox, cancel ;when cancell
{
msgbox,終了します
goto exit
}
IfExist, %1% ;%1% exist
SetWorkingDir, %1%
else ;
{
msgbox,dir not found
goto dirnotfound
}
}
;;;;;;;;;;;;;;;;;;;;;;;;;;
;関数定義
f(){
;dir = %A_WorkingDir%
Loop,*,2,0 ;フォルダでまわす。サブフォルダに潜る
{
SetWorkingDir, %A_LoopFileName%
f() ;再帰
SetWorkingDir, .. ;上に戻る
}
;SetWorkingDir, %dir% ;元のディレクトリに戻る
SplitPath, A_WorkingDir, dirname, parentdir
IfExist, index.html ;index.htmlが存在したら削除
{
FileDelete, index.html
}
fl = <html>`n<head>`n<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">`n<title>%dirname%</title>`n</head>`n ;頭
FileAppend , %fl%, index.html
fl = <body>`n<br>%dirname%/<br><br>`n<a href="./index.html">./</a><br>`n<a href="../index.html">../</a><br>`n ;フォルダ名
FileAppend , %fl%, index.html
dircount = 0
filecount = 0
Loop,*,2,0 ;フォルダでまわす。フォルダタグ生成
{
fl = <a href="%A_LoopFileName%/index.html">%A_LoopFileName%/</a><br>`n
FileAppend , %fl%, index.html
dircount++
}
Loop,*,0,0 ;ファイルでまわす。ファイルタグ生成
{
if (A_LoopFileName = "desktop.ini")
continue
fl = <a href="%A_LoopFileName%">%A_LoopFileName%</a>, size:%A_LoopFileSize%byte, modified:%A_LoopFileTimeModified%<br>`n
FileAppend , %fl%, index.html
;filecount = %A_Index%
filecount++
}
fl = <br><i>%dircount% dirs and %filecount% files</i><br>`n</body>`n</html>`n ;body閉じる
FileAppend , %fl%, index.html
}
;;;;;;;;;;;;;;;;;;;;;;;;;;
;実行
f()
tooltip,indexdumper完了
Sleep, 1000
tooltip,
exitapp
dirnotfound:
exitapp, 1
exit:
exitapp, 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment