Jump to content

Read file names of given path


Recommended Posts

hi autoitquestion,

_FileListToArray => lists all files of a given ath to an array

FileGetTime => Returns time and date information of a file.

Edit: Maybe you want to use the search functions in the helpfile and the forum first before posting questions. No offend, but I think these things can be found easily by searching. :unsure:

Edited by Hannes123
Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

So I search myself in manual and eventually I try search for file name begin with getName_ in path: C:\temp. I did as below:

$search = FileFindFirstFile("C:\temp\getName_") 
                If $search = -1 Then
                    ConsoleWrite("search failed")
                Else
                    ConsoleWrite("search passed")
                EndIf

file exist and it print search failed

What could be the reason?

Edited by autoitquestion
Link to comment
Share on other sites

  • Developers

So I search myself in manual and eventually I try search for file name begin with getName_ in path: C:\temp. I did as below:

$search = FileFindFirstFile("C:\temp\getName_") 
                If $search = -1 Then
                    ConsoleWrite("search failed")
                Else
                    ConsoleWrite("search passed")
                EndIf

file exist and it print search failed

What could be the reason?

What do you think the issue could be?

Read the helpfile .... think a little .. then answer. :unsure:

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Moderators

You need a wildcard "*"

eg.

FileFindFirstFile(@TempDir & "\getName_*")

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

If you take a look at the manual you'll see something like this:

Function: FileFindFirstFile

Parameters

filename: File search string. (* and ? wildcards accepted)

==> You'll need to use wildcards! :unsure:

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

So...

First of all-thanks to all!

Second:

My solution is:

$search = FileFindFirstFile("C:\temp\*getName_*") 
                If $search = -1 Then
                    ConsoleWrite("search failed")
                Else
                    ConsoleWrite("search passed")
                                        ;in $value we'll get file name
                    $value= FileFindNextFile($search)
                EndIf
Link to comment
Share on other sites

  • Developers

So...

First of all-thanks to all!

Second:

My solution is:

Ok... this time a little more serious:

Of course that is the obvious answer.

The reason I posted the way I did was that you seem to fire questions in these forums without putting too much effort in yourself.

So do us and yourself a favor and take this all a little more serious because that will pay back.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

So...

First of all-thanks to all!

Second:

My solution is:

$search = FileFindFirstFile("C:\temp\*getName_*") 
                If $search = -1 Then
                    ConsoleWrite("search failed")
                Else
                    ConsoleWrite("search passed")
                                        ;in $value we'll get file name
                    $value= FileFindNextFile($search)
                EndIf

That's a start, but with this you'll only find one file, not all of them. Look at the example in the manual. :unsure:
Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
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...