Sign in to follow this  
Followers 0
autoitquestion

Read file names of given path

11 posts in this topic

Hi,

How can I read the last modified file name in given path?

And how can I get all file names of given path

Thanks a lot ahead!

Noa :-)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
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?

What do you think the issue could be?

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


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

Spoilsports :>

Do you think we can make independent replys 4 in a minute next time? :unsure:


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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]

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