Create a VBScript script (w3_firstname_lastname.vbs) that takes one parameter (folder name) to do the following 1) List all files names, size, date created in the given folder 2) Parameter = Root Folder name The script should check and validate the folder name 3) Optionally, you can save the list into a file “Results.txt” using the redirection operator or by creating the file in the script. 4) Make sure to include comment block (flowerbox) in your code.

Respuesta :

tonb

Answer:

Set args = Wscript.Arguments

If (WScript.Arguments.Count <> 1) Then

 Wscript.Echo "Specify the folder name as a command line argument."

Else

   objStartFolder = args.Item(0)

   Set objFSO = CreateObject("Scripting.FileSystemObject")

   if (Not objFSO.FolderExists(objStartFolder)) Then

       Wscript.Echo "Folder "&objStartFolder&" does not exist"

   Else

       Set objFolder = objFSO.GetFolder(objStartFolder)

       Set colFiles = objFolder.Files

       For Each objFile in colFiles

           Wscript.Echo objFile.Name, objFile.Size, objFile.DateCreated

       Next

   End If

End If

Explanation:

Here's some code to get you started.

Otras preguntas