1. Buka notepad dan salin vbscript di bawah ini :
On Error Resume Next
Const WINDOW_HANDLE = 0
Const BIF_EDITBOX = &H10
Const BIF_NONEWFOLDER = &H0200
Const BIF_RETURNONLYFSDIRS = &H1
Set objShell = CreateObject("Shell.Application")
Set wshShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'**Browse For Folder To Be Processed
strPrompt = "Please select the folder to process."
intOptions = BIF_RETURNONLYFSDIRS + BIF_NONEWFOLDER + BIF_EDITBOX
strTargetPath = wshShell.SpecialFolders("MyDocuments")
strFolderPath = Browse4Folder(strPrompt, intOptions, strTargetPath)
Set objNewFile = objFSO.CreateTextFile(strFolderPath & "\filelist.txt", True)
Set objFolder = objFSO.GetFolder(strFolderPath)
Set objColFiles = objFolder.Files
For Each file In objColFiles
 objNewFile.WriteLine(file.Name)
Next
objNewFile.Close
'**Browse4Folder Function
Function Browse4Folder(strPrompt, intOptions, strRoot)
 Dim objFolder, objFolderItem
 On Error Resume Next
 Set objFolder = objShell.BrowseForFolder(0, strPrompt, intOptions, strRoot)
   If (objFolder Is Nothing) Then
    Wscript.Quit
 End If
   Set objFolderItem = objFolder.Self
   Browse4Folder = objFolderItem.Path
   Set objFolderItem = Nothing
   Set objFolder = Nothing
End Function
2. Save sebagai "namafile.vbs"
3. Klik benda tu dan akan keluar prompt screen dan pilih folder yang awak nak listkan file di dalamnya.
4. Kemudian dia akan keluar lah "filelist.txt" di dalam folder yang anda indexkan tadi.
5. Contoh sekiranya anda index folder MyDocuments maka  "filelist.txt" akan dicreate dalam folder MyDocuments.
6. Mengenai tulisan merah anda boleh ubah kepada "MyDocuments / MyComputer / Bla..Bla..Apa Je Folder Yang Awak Nak"
terernya coding..huhu
ReplyDeleteHehe,mklumat yg bgus,.
ReplyDelete