StOnge Posted June 18, 2009 Share Posted June 18, 2009 (edited) Hello All, I'm trying to write a script that executes a series of commands if there are less than four files in a certain directory. For troubleshooting purposes, I wrote it so that if there are more than three files detected, the script exits, Else it executes the commands. The commands are working fine, I just can't seem to get it recognize that there are more than three files in the directory. Here is my script so far: $s = DirGetSize("[directory here]" , 1) If $s > 3 Then Exit Else [commands here] EndIf Edited June 18, 2009 by StOnge www.stonge.com Link to comment Share on other sites More sharing options...
November Posted June 18, 2009 Share Posted June 18, 2009 (edited) Using your method: $s = DirGetSize("c:\temp" , 3);option 1 and 2 If $s[1] > 3 Then msgbox(32, "Exiting", "Files in directory : " & $s[1]) Exit Else msgbox(32, "test box", $s[1]) EndIf Or like this: #Include <File.au3> $path = "c:\temp" $files = _FileListToArray($path, "*", 1); find switches in helpfile, this is used to return only files $total = ubound ($files) -1 MsgBox(32, "File Count", "Files in " & $path & " : " & $total) Cheers Edited June 18, 2009 by November Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now