-1

I am making a program that scans any new file downloaded into the system. Currently, I have used a file watcher that monitors a directory. Whenever a file is downloaded from chrome then the following happens :

For example: Let's say a pdf file is being downloaded.

  • .tmp file created first

  • .tmp file is renamed to .crdownload

  • .crdownload is modified multiple times

  • .crdownload file is renamed to .pdf

  • .pdf file is modified multiple times.

The problem is when can I say a file is downloaded because it is modified multiple times after renaming from .crdownload to .pdf file.

Is there any way to detect a new file downloaded into a system?

Thanks for the help.

Platform: Windows

Language: C, C++

jaykr
  • 81
  • 7

1 Answers1

0

from what I understood you want it to get the file final extension, for this you can check the file extension evrytime to see if it is a .tmp or .crdownload; but not check for if it is a new file. Sorry for my bad English, Hope this helps.

Qognitive
  • 1
  • 3
  • No, I just want to know when the file is downloaded fully. After renaming to file the final extension it modifies multiple times so not sure when we can say it is fully downloaded. – jaykr Jul 20 '22 at 07:09
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 20 '22 at 20:51