Recent

Author Topic: [Closed] Making a special file scanning application !  (Read 1369 times)

loaded

  • Hero Member
  • *****
  • Posts: 853
[Closed] Making a special file scanning application !
« on: February 28, 2024, 01:11:16 pm »
Hi All,
I am thinking of doing a study that scans folders, archives the file names of the files in the folder and the textual expressions in the file (the files to be scanned contain binary data) in the database, and then access this data by querying.

I have too many nested folders. After scanning all these and completing the process;
Is there a method that will automatically notify you when one of the folders is changed or added?
Or do I have to scan all folders over and over again each time?
I would appreciate it if anyone with experience could share. Respects.
« Last Edit: February 28, 2024, 01:54:37 pm by loaded »
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

Fibonacci

  • Hero Member
  • *****
  • Posts: 613
  • Internal Error Hunter
Re: Making a special file scanning application !
« Reply #1 on: February 28, 2024, 01:14:08 pm »
https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-readdirectorychangesw

If you will watch "C:\" (or other disk), you will get notified if any file/folder on this disk is modified/created/deleted or renamed.
« Last Edit: February 28, 2024, 01:17:39 pm by Fibonacci »

cdbc

  • Hero Member
  • *****
  • Posts: 1673
    • http://www.cdbc.dk
Re: Making a special file scanning application !
« Reply #2 on: February 28, 2024, 01:21:33 pm »
Hi
Have a 'looksee' at this: https://github.com/Wosi/DirectoryWatcher
It's written in pascal...  :D
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

loaded

  • Hero Member
  • *****
  • Posts: 853
Re: Making a special file scanning application !
« Reply #3 on: February 28, 2024, 01:43:02 pm »
Thank you very much to both of you, Fibonacci and cdbc, for your nice answers.
Brother cdbc, I tried the example you gave and it works fine.
The only problem is that the application must be running constantly to detect the folder change.
For now, what I have in mind is that the application should work whenever I want it, rather than having it open all the time.
If there is such a feature in folder attributes I'd like to know about it, otherwise I'll keep the above aside as a solution.
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

Fibonacci

  • Hero Member
  • *****
  • Posts: 613
  • Internal Error Hunter
Re: Making a special file scanning application !
« Reply #4 on: February 28, 2024, 01:47:25 pm »
You could read the NTFS journal, but its much more difficult than just scan -> watch

https://stackoverflow.com/questions/46978678/walking-the-ntfs-change-journal-on-windows-10

loaded

  • Hero Member
  • *****
  • Posts: 853
Re: Making a special file scanning application !
« Reply #5 on: February 28, 2024, 01:54:23 pm »
Fibonacci brother, yes you are right, Sometimes they say, "The shortest way is the way you know."
I will apply brute force and scan every time and try to solve the problem on the database side of the issue.
Thank you very much for taking your precious time to reply.
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

 

TinyPortal © 2005-2018