Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Check file size and run batch file

$
0
0

Hi.

I have the following script with which I check the file size and run a batch file depending on the size. My problem is that the file name will be different each time. There will be one file at a time in that folder. The script does not want to use the wildcard and states "Microsoft VBScript runtime error: File not found". Any ideas?

Dim fso
Dim fil
Dim shell1

Set fso = CreateObject("scripting.filesystemobject")

Set fil = fso.GetFile ("C:\Scripts\test\*.txt")

Set shell1 = createobject("wscript.shell")

If fil.Size > 0 Then
        shell1.run "C:\Scripts\test\Copy.bat"
Else
        shell1.run "C:\Scripts\test\move.bat"
End If


Best Regards, Morris Fury AFRIDATA.net


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>