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++
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.