Jump to content

DirGetSize Question


Recommended Posts

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 by StOnge

www.stonge.com

Link to comment
Share on other sites

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 :D

Edited 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...