Sign in to follow this  
Followers 0
JonF

Getting a directory name when only part of it is known

2 posts in this topic

#1 ·  Posted (edited)

I have a situation in which there is a directory containing a whole bunch of directories, each containing files I need to copy (by writing a script file for another language). I know the entire path except the last few characters of the last directory name. These last few characters follow an underscore. I tried:

; $CmdLine[1] is the path to the set of directories
For $i = 0 To (UBound($DriverNames) - 1)
  $SearchHandle =FileFindFirstFile($CmdLine[1] & $DriverNames[$i] & "_*")
  If $SearchHandle Then
    FileWriteLine($FileHandle,"FileCopy," & $FileFindNextFile($SearchHandle) & "*.*,%Target_Win%\Inf")
    FileClose($SearchHandle)
  EndIf
Next

The If test is true, but FileFindNextFile returns a null string. What am I missing?

Edited by JonF

Share this post


Link to post
Share on other sites



I have a situation in which there is a directory containing a whole bunch of directories, each containing files I need to copy (by writing a script file for another language). I know the entire path except the last few characters of the last directory name. These last few characters follow an underscore. I tried:

; $CmdLine[1] is the path to the set of directories
For $i = 0 To (UBound($DriverNames) - 1)
  $SearchHandle =FileFindFirstFile($CmdLine[1] & $DriverNames[$i] & "_*")
  If $SearchHandle Then
    FileWriteLine($FileHandle,"FileCopy," & $FileFindNextFile($SearchHandle) & "*.*,%Target_Win%\Inf")
    FileClose($SearchHandle)
  EndIf
Next

The If test is true, but FileFindNextFile returns a null string. What am I missing?

Hi,

just a: If $SearchHandle <> -1 Then

;-))

Stefan

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  
Followers 0