Jump to content

Can't find a file with a dot in the filename


DEtHMoroZ
 Share

Recommended Posts

Hi there!

I manage to make small helper program, that perform installation of several programs in a row w\o any additional clicks.

And suddenly i run into small (and very unexpected problem).

When i perform FileFindFirstFile search cant find files with dot in the name :D

Example of file name: "VeryImportantConfigFileV0.65.cfg"

Question: How to find\look for file with a dot in it's name?

p.s. i had some experiments with this:

and it is clearly shows that the problem is in dot.

Thx in advantage, DEtH_MoroZ

Link to comment
Share on other sites

should do the job

Global $output = '', $cmd
$cmd = Run(@ComSpec & " dir /B *.*", "", @SW_HIDE, $STDOUT_CHILD)
While ProcessExists($cmd)
$line = StdoutRead($foo)
If ($line) Then
$output &= $line & @CRLF
EndIf
Sleep(100)
WEnd
MsgBox(0,"CMD Output",$output)

;first file
$sFirstF = StringRegExp($output,"v+", 3)
If IsArray($sFirstF) Then MsgBox(0,"First File",$sFirstF[0])
Exit

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

Link to comment
Share on other sites

Still not sure how to use it.

However, thx for your help, now i know the direction to dig to.

I create a function for easy use, just test it ;)

Global $STDOUT_CHILD = 0x2
$list = _listDir("c:windows", 1)
MsgBox(0,"First File",$list[1])
Exit

Func _listDir($slistdir, $nFilenumber = 1, $listForders = 0) ; [0] = all files list, [1] = Your 'n'th file selected (Default one is the first)
Local $cmd, $line, $sReturn[2] = ['',''], $folTag = ''
If $listForders Then $folTag = " /A:D"
$hCMD = Run(@ComSpec & " /k dir /B" & $folTag & " *.*", $slistdir, @SW_HIDE, $STDOUT_CHILD)
While 1
$line = StdoutRead($hCMD)
If @error Then ExitLoop
$sReturn[0] &= $line & @CRLF
WEnd
$sFirstF = StringRegExp($sReturn[0],"V+", 3)
If IsArray($sFirstF) Then $sReturn[1] = $sFirstF[$nFilenumber-1]
Return $sReturn
EndFunc

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

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