Jump to content

Recommended Posts

Posted

Try this:

; Shows the filenames of all files in the current directory.
$search = FileFindFirstFile("*.*")  

; Check if the search was successful
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf
$i = 0

While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop
    $i = $i + 1 
WEnd
MsgBox (0, "Files", "There are " &$i&" files and folders in the directory.")
; Close the search handle
FileClose($search)
Posted

check out _FileListToArray in file.au3

#include <File.au3>

_FileListToArray ( $sPath [, $sFilter [, $iFlag]] )

Optional: specifies wheather to return files folders or both

$iFlag=0(Default) Return both files and folders

$iFlag=1 Return files only <---great filter if you want files only

$iFlag=2 Return Folders only

The array returned is one-dimensional and is made up as follows:

$array[0] = Number of Files\Folders returned <------what you want

Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

Posted

You can also use DirGetSize() function.

If you use the extended mode then the array returned from this function is a single dimension array containing the following elements:

$array[0] = Size

$array[1] = Files count

$array[2] = Dirs Count

#include <Array.au3>

$size = DirGetSize(@DesktopDir, 1)
_ArrayDisplay($size, 'Files')
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Posted
  Quote

If looking for all files shouldn't we use '*' instead of '*.*' ?

I think that using *.* is more “secure”, because when you use *.* it search for all files with any extansion.

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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
  • Recently Browsing   0 members

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