ezzetabi Posted July 29, 2004 Posted July 29, 2004 I am making a func that uses FileFindNextFile() for rolling files in a folder, so far so good. The parameter of this search is a full path with wildcards. E.g. c:\hello\*.* The result of the next FindNextFile() are without the path! How can I have it back? I thought FileGetShortName or LongName had this function but I was wrong. I checked in the help file but I am still solution-less.
Holger Posted July 29, 2004 Posted July 29, 2004 Hmmm....in my 'search'-functions I always put the path and filename independent to the FileFind.... Like: $path = "C:\Test\" $file = "*.*" $search = FileFindFirstFile($path & $file) ... Do you understand what I mean? You can now later use the 'saved' path... Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
this-is-me Posted July 29, 2004 Posted July 29, 2004 Save the path and do $path & "\" & $file Who else would I be?
ezzetabi Posted July 29, 2004 Author Posted July 29, 2004 (edited) If anyone can have my same problem... ($a is just an example) Dim $a, $path, $file, $c ; $a is the starting point. It may be a full path or just a filename. $a = c:\temp\name.txt If Not StringInStr($a, "\") Then $path = @WorkingDir & "\" ;and $file = $file;-D Else For $C = StringLen($a) To 1 Step - 1 If StringMid($a, $C, 1) = "\" Then $PATH = StringLeft($a, $C) $FILE = StringTrimLeft($a, $C) ExitLoop EndIf Next EndIf MsgBox(0,"",$path & " " & $file) Edit: Improved code. Edited July 29, 2004 by ezzetabi
Bartokv Posted July 29, 2004 Posted July 29, 2004 I agree with the others, it's typically easier to save the path in a separate array for later use. However you can also use the @WorkingDir macro to obtain the name of the current working directory.If you only have access to the full filename, along with path (ie: [full path]\[filename].[ext]) then you can use the StringSplit function to make it easy to separate the file name and path.Several months ago, I posted an example of how to search the entire computer for a specified file. The code is very slow but it could be optimized for your needs. Feel free to check out this post, if you're curious.
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