2000/11/25 (土) 23:39:12        [mirai]
'ファイルツリー出力
'
'ファイルツリーをftreeout.txtに出力します。
'最初のダイアログで、ルートにするフォルダを選びます。

Dim sLine,sRootDir,sOutFile
Set Fs = WScript.CreateObject("Scripting.FileSystemObject")
Set Shell = WScript.CreateObject("Shell.Application")

sOutFile="ftreeout.txt"

If WScript.Arguments.Count>0 Then
    sRootDir=WScript.Arguments(0)
End If

If Fs.FolderExists(sRootDir) Then
	Set oRootDir = Shell.NameSpace(sRootDir)
Else
	Set oRootDir = Shell.BrowseForFolder(0,"ルートフォルダの選択",0)
	If IsEmpty(oRootDir) Then WScript.Quit
End If

Set ts=Fs.CreateTextFile(sOutFile,True)

ts.WriteLine oRootDir.Title
Search oRootDir.Items.Item 'oRootDir.Self 'Win2000の場合
ts.Close
WScript.Echo "終了"

Sub Search(obj)
	Dim I
	I=1	
	If obj.IsFolder Then
		Set oItems=obj.GetFolder.Items
		For Each child In oItems
			If child.IsFolder Then
				tmp= "■" & child.Name 
			Else
				tmp= child.Name 
			End If
			
			If I=oItems.Count Then
				ts.WriteLine sLine & "┗"  & tmp
				sLine=sLine & " "
			Else
				ts.WriteLine sLine & "┣"  & tmp
				sLine=sLine & "┃"
				I=I+1
			End If
			Search child
		Next
	End If
	If Len(sLine)>0 Then
        sLine=Left(sLine,Len(sLine)-1)
    End If
End Sub


拡張子vbsで保存しれ
んで実行してお気に入りをはりつけろ