Home > other >  File operations, hope friends comment!!!!!!
File operations, hope friends comment!!!!!!

Time:04-21

Said demand first,
Need to extract the file within the specified folder, and increase of the files in the folder is a dynamic, file properties for streaming media (audio file), for the time being by way of the two kinds of extraction, always can't satisfy the demand:

The first way:
Use watchdog, the feeling is inaccurate monitoring documents (missing documents), a new file to establish rules will lead to subsequent exception error (establish rules file system first establish change recording, when the tape is invalid automatically delete the recording file, the other is itself a streaming media file, the file is not a one-time built, there are file exists, but do not read,), the watchdog way, to pass the first,

The second way:
According to the time the file was last modified to extract files, traverse the entire folder, extract the files specified time intervals (time is the dynamic increase), this way is feasible, but the biggest problem, file within the folder of the new, updated once every time, have to traverse a folder, traverse time is very long, in time, estimated that the file is missing,

The great god and there is no other way, please?

CodePudding user response:

Use database, when added a media files in the folder, just add a record in table form, and set up a backup tag attributes, the default value is False
Your program just monitor the table
File if extract went, tag is updated to True, without frequent operation period, backup True records to another table
  • Related