Recent

Author Topic: Get latest created file in directory  (Read 7031 times)

markostarko

  • New Member
  • *
  • Posts: 10
Get latest created file in directory
« on: July 28, 2012, 08:31:18 pm »
Hello

I need to check if new folder was created in directory, I could get modifeid date and i could check for highest value, but i am wondering is there any other solutions for this problem.
Just looking for ideas...


Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Get latest created file in directory
« Reply #1 on: July 28, 2012, 08:36:21 pm »
Nope, that's the best solution.

markostarko

  • New Member
  • *
  • Posts: 10
Re: Get latest created file in directory
« Reply #2 on: July 28, 2012, 08:41:03 pm »
Thanx

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: Get latest created file in directory
« Reply #3 on: July 28, 2012, 08:55:45 pm »
If you want to be informed about directories created while the program is running you can use the file notification system on windows. You can find a code sample for Delphi here: http://delphi.about.com/library/code/ncaa030403b.htm.
On *nix you can use inotify or dnotify to monitor changes in directories.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Get latest created file in directory
« Reply #4 on: July 29, 2012, 10:29:15 am »
Regarding that notification system: I vaguely recall somebody was going to make or already made a cross-platform unit that encapsulated that functionality... am I mistaken there?
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Get latest created file in directory
« Reply #5 on: July 29, 2012, 01:15:53 pm »
I forgot to ask the OP what his actual goal is. A notification system is probably too much for a simple program.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Get latest created file in directory
« Reply #6 on: July 29, 2012, 02:11:52 pm »
Regarding that notification system: I vaguely recall somebody was going to make or already made a cross-platform unit that encapsulated that functionality... am I mistaken there?

Yep, found some links here: somebody apparently started on it but seemingly no news since:
http://www.mail-archive.com/fpc-pascal@lists.freepascal.org/msg21745.html

This is a link to some code (haven't used it):
http://www.mail-archive.com/fpc-pascal@lists.freepascal.org/msg25349.html
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

 

TinyPortal © 2005-2018