MRXTO09 Posted February 4, 2014 Posted February 4, 2014 (edited) 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 February 4, 2014 by MRXTO09
orbs Posted February 4, 2014 Posted February 4, 2014 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 WinPose - simultaneous fluent move and resize 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 Magic Math - a math puzzle Demos: Title Bar Menu - click the window title to pop-up a menu
MRXTO09 Posted February 4, 2014 Author Posted February 4, 2014 (edited) did you look at this? _FileListToArray() If Not $hFiles[1] = "" Then Global $folder = $aFolderList[$i] __upload() Global $folder = "" EndIf this don't work Edited February 4, 2014 by MRXTO09
orbs Posted February 4, 2014 Posted February 4, 2014 (edited) 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 February 4, 2014 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 WinPose - simultaneous fluent move and resize 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 Magic Math - a math puzzle Demos: Title Bar Menu - click the window title to pop-up a menu
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