/build/static/layout/Breadcrumb_cap_w.png

Write down the file name, file size in MB and last modified date

i need vbscript for below query.

Write down the file name, file size in MB and last modified date of all files in Windows directory to a text file. The output should be like below. You can format the output using #3 task.
File Name File Size Last Modified Date
Abc.txt 1 MB 01/01/2011
Xyz.exe 0.1 MB 02/01/2011


please Any help on this.

0 Comments   [ + ] Show comments

Answers (2)

Posted by: captain_planet 13 years ago
Black Belt
0
That's easy....

Use a vbscript similar to the following, which will enable you to enumerate files in the windows folder:

http://technet.microsoft.com/en-us/library/ee198703.aspx

Then Google for 'FileSystemObject' and the following properties:

OpenTextFile
DateLastModified
Name
Size

and then once you've shown that you've actually made an effort, there are lots of people here that will help you finish the job.
Posted by: itolutions 13 years ago
Purple Belt
0
Also you can use commandline:
dir >> c:\myfile.txt
to get info in format:

02.05.2011 17:08 <DIR> %HOMESHARE%
03.02.2011 11:45 <DIR> .gimp-2.4
03.02.2011 11:41 9 814 .recently-used.xbel
14.12.2010 17:57 <DIR> .thumbnails
04.05.2011 14:21 <DIR> Contacts
04.07.2011 13:45 <DIR> Desktop



VbScript:
Dim oShell
Set oShell = WScript.CreateObject ("WScript.Shell")
oShell.run "cmd /K dir >> c:\myfile.txt"
Set oShell = Nothing
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ