Page 1 of 1
get date to file
Posted: Mon Nov 08, 2021 7:48 pm
by Krynn
Hello,
I would like to recover the creation date of a file.
I can get the date, but it is in the form of ticks. And I don't know how to convert it.
Code: Select all
put files((fld "Chemin"), detailed) into field "listing"
set the itemdelimiter to ","
put item 4 of line 1 of field "listing" into TempsCreate
I can get the date with the shell, but as I have to do this for many files, it is too slow.
Do you have any idea how to do this?
thanks
Re: get date to file
Posted: Mon Nov 08, 2021 9:12 pm
by FourthWorld
I suspect the slowest part of that is rendering the long file list in a field. If you don't need to display the list use a variable instead. If it's still too slow we can investigate further.
Re: get date to file
Posted: Mon Nov 08, 2021 9:27 pm
by dunbarx
Hi.
Not sure what your handler does, But you can convert the ticks to a date. Perhaps in a button script:
Code: Select all
on mouseUp
get the ticks --returned by your handler
divide it by 60
convert it to date
end mouseUp
"Convert" will not work directly on the ticks. We are changing those to the "seconds" You can convert also to "dateItems" which might give you even more information.
Craig
Re: get date to file
Posted: Mon Nov 08, 2021 10:36 pm
by Krynn
"Convert" will not work directly on the ticks. We are changing those to the "seconds" You can convert also to "dateItems" which might give you even more information.
Craig
thank you very much, it works great
It seems so simple.
Time for 119 files:
- with shell: 34 secondes
- with convert date: 0.2 secondes.
Re: get date to file
Posted: Mon Nov 08, 2021 10:38 pm
by Krynn
FourthWorld wrote: ↑Mon Nov 08, 2021 9:12 pm
I suspect the slowest part of that is rendering the long file list in a field. If you don't need to display the list use a variable instead. If it's still too slow we can investigate further.
I have about 1000 files.
I already store in a variable.
The problem was the console that displays 1000x is about 1 second per file. that's what slows it down.
but thanks for your feedback
Re: get date to file
Posted: Tue Nov 09, 2021 2:58 am
by FourthWorld
Krynn wrote: ↑Mon Nov 08, 2021 10:38 pm
FourthWorld wrote: ↑Mon Nov 08, 2021 9:12 pm
I suspect the slowest part of that is rendering the long file list in a field. If you don't need to display the list use a variable instead. If it's still too slow we can investigate further.
I have about 1000 files.
I already store in a variable.
The problem was the console that displays 1000x is about 1 second per file. that's what slows it down.
but thanks for your feedback
Happy to help. Thanks for confirming that the display rendering was the bottleneck.
Re: get date to file
Posted: Tue Nov 09, 2021 10:45 am
by Klaus
Hi Krynn,
Krynn wrote: ↑Mon Nov 08, 2021 7:48 pm
I can get the date, but it is in the form of ticks. And I don't know how to convert it.
Code: Select all
put files((fld "Chemin"), detailed) into field "listing"
set the itemdelimiter to ","
put item 4 of line 1 of field "listing" into TempsCreate
...
to be precise:
The fourth item in the detailed file list is in
SECONDS not ticks!
Best
Klaus
Re: get date to file
Posted: Tue Nov 09, 2021 3:31 pm
by dunbarx
Krynn.
Hmmm.
If Klaus is correct, then you do not need to convert. If you do, your dates will be rather older.
Craig
Re: get date to file
Posted: Tue Nov 09, 2021 6:10 pm
by jacque
Klaus is right, see the dictionary.
Re: get date to file
Posted: Tue Nov 09, 2021 7:15 pm
by Klaus
Hi Craig,
dunbarx wrote: ↑Tue Nov 09, 2021 3:31 pm
If Klaus is correct...
sorry, don't understand!?
Best
Klaus
Re: get date to file
Posted: Tue Nov 09, 2021 7:39 pm
by dunbarx
Klaus.
It means do you know what you are talking about. I get this all the time.
Craig
Re: get date to file
Posted: Tue Nov 09, 2021 7:45 pm
by Klaus
dunbarx wrote: ↑Tue Nov 09, 2021 7:39 pm
Klaus.
It means do you know what you are talking about. I get this all the time.
Craig
