Jump to content

how find subfiles on subfolder


MRXTO09
 Share

Recommended Posts

i need to find a subfiles and get the name of the file and the name of the subfolder if the file exists and put alll this line in array.

i've try this

Func __CheckUpload()
$aFolderList = _FileListToArray($dir,"*",2)
for $i=1 to UBound($aFolderList)-1
   $hFiles = _FileListToArray($dir&"\"&$aFolderList[$i],'*.txt',1)
   If Not $hFiles[1] = "" Then 
      Global $folder = $aFolderList[$i]
      __upload()
      Global $folder = ""
   EndIf
Next
EndFunc 

This Is possibile?

Edited by MRXTO09
Link to comment
Share on other sites

did you look at this?

_FileListToArray()

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

first, don't declare/re-declare Global variables inside a function. use Global only to create the variable for the first time, not when using it.

second, if no files found then _FileListToArray() will not return an array, so the syntax $hFiles[1] is invalid. check @error after every call to _FileListToArray() to detect this.

Not is an operand, it is subject to mathematical rules. you need to add parenthesis to use it, because this:

not a = b

is the same as:

( not a ) = b

and is not the same as

not ( a = b )

which is what you need. but as you will see now, the @error check makes the Not check unnecessary:

Func __CheckUpload()
    $aFolderList = _FileListToArray($dir,"*",2)
    If @error Then
        MsgBox(16,'Error:','error reading folders list or no folders fonud.')
    Else
        for $i=1 to UBound($aFolderList)-1
            $hFiles = _FileListToArray($dir&"\"&$aFolderList[$i],'*.txt',1)
            If @error Then
                MsgBox(48,'Alert:','no .txt files fonud in folder:'&@CR&$aFolderList[$i])
            Else
                $folder = $aFolderList[$i]
                __upload()
                $folder = ""
            EndIf
       Next
   EndIf
EndFunc
Edited by orbs

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

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...