Jump to content
Sign in to follow this  
DEtHMoroZ

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

Recommended Posts

DEtHMoroZ

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

Share this post


Link to post
Share on other sites
Kyan

use cmd "dir /B" with stringregexp


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

Share this post


Link to post
Share on other sites
DEtHMoroZ

Thx for your help.

Can you give me please scripting example?

Share this post


Link to post
Share on other sites
Kyan

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

Share this post


Link to post
Share on other sites
DEtHMoroZ

Still not sure how to use it.

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

Share this post


Link to post
Share on other sites
Kyan

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

Share this post


Link to post
Share on other sites
DEtHMoroZ

So, practically we just run cmd.exe and do a query to it (with what ever we need) and then parse callback back into auto it.

O_o

Nice, thx alot. Now i get it.

Share this post


Link to post
Share on other sites
Spiff59

If you use "*" as the wildcard in FileFindFirstFile(), instead of "*.*" it will return a complete file list.

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  

×