Jump to content
Sign in to follow this  
StOnge

DirGetSize Question

Recommended Posts

StOnge

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

Share this post


Link to post
Share on other sites
November

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]

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.