Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.
Computer Hope forum e-mail issues and down time
0 Members and 1 Guest are viewing this topic.
Set objFS = CreateObject("Scripting.FileSystemObject")strFolder = "C:\test"Set objFolder = objFS.GetFolder(strFolder)For Each Files In objFolder.Files If objFS.GetExtensionName(Files) = "png" Then If Files.Size > 10000 Then WScript.Echo "File " & Files.Name & " found." End If End If Next
c:\test> cscript /nologo script.vbs
Hi thanks for that, but then how do i delete those files?Cheers,Ian
Set objFS = CreateObject("Scripting.FileSystemObject")strFolder = "C:\test"Set objFolder = objFS.GetFolder(strFolder)For Each Files In objFolder.Files If objFS.GetExtensionName(Files) = "doc" Then If Files.Size > 10000 Then WScript.Echo "File " & Files.Name & " found." objFS.DeleteFile(Files) End If End If Next
what requirements have you not stated yet?
it looks into folder and delete .png files IF the size is below 10kb.