CN110688344A - File scanning method and device, computer readable storage medium and terminal - Google Patents

File scanning method and device, computer readable storage medium and terminal Download PDF

Info

Publication number
CN110688344A
CN110688344A CN201910902872.XA CN201910902872A CN110688344A CN 110688344 A CN110688344 A CN 110688344A CN 201910902872 A CN201910902872 A CN 201910902872A CN 110688344 A CN110688344 A CN 110688344A
Authority
CN
China
Prior art keywords
file
subfile
scanning
files
sets
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910902872.XA
Other languages
Chinese (zh)
Inventor
宋文强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
JRD Communication Shenzhen Ltd
Jiekai Communications Shenzhen Co Ltd
Original Assignee
Jiekai Communications Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jiekai Communications Shenzhen Co Ltd filed Critical Jiekai Communications Shenzhen Co Ltd
Priority to CN201910902872.XA priority Critical patent/CN110688344A/en
Publication of CN110688344A publication Critical patent/CN110688344A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/122File system administration, e.g. details of archiving or snapshots using management policies
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application discloses a file scanning method, a file scanning device, a computer readable storage medium and a terminal, wherein the file scanning method comprises the following steps: receiving a file scanning request, acquiring a file set according to the scanning request, dividing files in the file set to obtain a plurality of subfile sets, matching target thread units for the subfile sets, wherein the target thread units are in one-to-one correspondence with the subfile sets, and scanning the corresponding subfile sets based on each target thread unit. The scheme of the application can effectively improve the file scanning rate.

Description

File scanning method and device, computer readable storage medium and terminal
Technical Field
The application relates to the field of mobile terminal application, in particular to a file scanning method, a file scanning device, a computer readable storage medium and a terminal.
Background
With the development of the internet and the mobile communication network, and the rapid development of the processing capability and the storage capability of the terminal, a great amount of applications are rapidly spread and used.
Many applications are currently on terminals, such as gallery, music player, etc. In operating these applications, rather than directly operating on files on the storage device, a database of media files is operated on. With the increase of the storage space of the terminal, media files stored on the storage device are more and more, and the time spent for scanning the media file information on the storage device to enter the media database is longer and longer, so that a user cannot see the media information before the end of scanning the media files. For example, pictures or video information cannot be seen in the gallery for a long period of time after the gallery is powered on, because the system is still scanning the media files on the storage device because the current media database is not updated.
In the related art, when a terminal scans system files, the system files are sorted by file names and then all folders are scanned in a traversing manner, so that the scanning manner is time-consuming.
Disclosure of Invention
The embodiment of the application provides a file scanning method, a file scanning device, a computer readable storage medium and a terminal, which can effectively improve the file scanning rate.
The embodiment of the application provides a file scanning method, which comprises the following steps:
receiving a file scanning request, and acquiring a file set according to the scanning request;
dividing the files in the file set to obtain a plurality of sub-file sets;
matching target thread units for the subfile sets, wherein the target thread units correspond to the subfile sets one by one;
scanning the respective set of subfiles based on each of the target thread units.
Correspondingly, an embodiment of the present application further provides a file scanning apparatus, including:
the receiving unit is used for receiving a file scanning request and acquiring a file set according to the scanning request;
the dividing unit is used for dividing the files in the file set to obtain a plurality of sub-file sets;
the matching unit is used for matching a target thread unit for the subfile set, and the target thread unit corresponds to the subfile set one by one;
a scanning unit for scanning the respective subfile set based on each of the target thread units.
Accordingly, the present application further provides a computer-readable storage medium, which stores a plurality of instructions, where the instructions are suitable for being loaded by a processor to perform the steps in the file scanning method as described above.
Correspondingly, an embodiment of the present application further provides a terminal, which includes a processor and a memory, where the memory stores a plurality of instructions, and the processor loads the instructions to execute the steps in the file scanning method as described above.
According to the scheme, a file scanning request is received, a file set is obtained according to the scanning request, files in the file set are divided, a plurality of subfile sets are obtained, the subfile sets are matched with target thread units, the target thread units correspond to the subfile sets one to one, and the corresponding subfile sets are scanned on the basis of each target thread unit. The scheme of the application can effectively improve the file scanning rate.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a file scanning method according to an embodiment of the present application.
Fig. 2 is a schematic flowchart of another file scanning method according to an embodiment of the present application.
Fig. 3 is a block diagram of a document scanning apparatus according to an embodiment of the present disclosure.
Fig. 4 is a file display interface diagram of a file scanning method according to an embodiment of the present application.
Fig. 5 is a schematic structural diagram of a terminal according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Based on the above problems, embodiments of the present application provide a file scanning method, an apparatus, a computer-readable storage medium, and a terminal, which can effectively improve a file scanning rate. The following are detailed below. It should be noted that the following description of the embodiments is not intended to limit the preferred order of the embodiments.
Referring to fig. 1, fig. 1 is a schematic flow chart illustrating a file scanning method according to an embodiment of the present disclosure. The file scanning method may be applied to mobile terminals such as mobile phones, tablet computers, notebook computers, palm top computers, Portable Media Players (PMPs), and fixed terminals such as desktop computers. The specific flow of the file scanning method can be as follows:
101. and receiving a file scanning request, and acquiring a file set according to the scanning request.
In this embodiment, the file scan request may be sent by the end system. The file scanning is to enter a file database by scanning file information, and to read and update data of a file. Wherein the file may be stored in a terminal memory and the file may be a media file. For example, the files may include media files such as pictures, music, and the like.
The file scanning request may be implemented in various ways. In some embodiments, the file scanning may be triggered by: when the terminal is detected to be switched from the power-off state to the power-on state, a file scanning instruction is triggered, and a scanning request is sent through the scanning instruction.
Specifically, when the terminal is in a power-off state, the user may perform a power-on operation on the terminal, and after the terminal is powered on, the system may send information for starting scanning, where the information may be sent in a broadcast manner.
For example, after the terminal completes the power-on operation, the system may send a broadcast, and the broadcast may be "intent. After receiving the broadcast information sent by the system, the file in the memory can be scanned. By executing the starting operation on the terminal and triggering the file scanning request, the storage content of the whole storage space can be scanned.
After receiving a file scan request, a file collection is obtained. Wherein the file collection may be a file library, which may be stored in a terminal memory. A collection of files may include multiple folders, for example, a collection of files may include folder A, folder B, folder C, and so on. Through the file scanning request, all folders in the terminal memory can be quickly acquired.
102. And dividing the files in the file set to obtain a plurality of sub-file sets.
In this embodiment, the files in the file set are divided, and there may be a plurality of dividing manners. For example, a collection of files may be divided by file name. The file sets are divided to obtain a plurality of subfile sets, so that the plurality of subfile sets can be conveniently scanned simultaneously, and time is saved.
In some embodiments, the step of "dividing files in a file collection" may include the following processes:
(11) acquiring file information of a file, wherein the file information at least comprises a file name;
(12) sorting the files according to the file names to obtain a third sorting result;
(13) and determining the number of the files, and dividing the files based on the number of the files and the sequencing result.
Specifically, after the file collection is obtained, the files in the file collection may be determined. Further, file information of the file is obtained, and the file information may include a file name, where the file name may be set by a user or default, for example, the user may create a new folder, and the folder name is set to be "picture". In order to conveniently and quickly search for the pictures, the user can add the pictures on the terminal to the picture folder for storage.
The file name may be a character string, and the character string may include numbers, letters, and words. For example, the file name may be set to: a123, file a, file B1, and so on. After the file names of all files are obtained, the initial of the file name is determined, for example, if the file name is: and A123, acquiring a letter of 'A', and if the file name is: file a, the obtained initial is "W", etc.
Specifically, after the first letters of all the file names are acquired, the files may be sorted according to the alphabetical order. For example, the alphabetical order may be: a-z, the first letters of the file names a-z may be ordered so that the result of the ranking of the files may be determined.
Further, after sorting the files, the number of files in the file collection is determined. For example, the number in a set of files may be 1, 2, 3, 10, and so on. Specifically, the file set is divided according to the sorting result and the number of the files.
When the file set is divided according to the sorting result and the number of the files, a plurality of dividing modes can be provided. In some embodiments, the step of "dividing the files based on the number of files and the sorting result" may include the following processes:
(131) comparing the number of files with the number of preset thread units;
(132) if the number of the files is smaller than the number of the preset thread units, dividing the file set into a subfile set with the number of the files, and determining the files in the subfile set according to a third sequencing result;
(133) and if the number of the files is greater than or equal to the number of the preset thread units, dividing the file set into sub-file sets with the number of the preset thread units, and determining the files in the sub-file sets according to a third sequencing result.
Specifically, the number of files in the file set is compared with the number of preset thread units. Wherein the thread unit may be configured to perform a scan operation on the matched file.
A thread is the smallest unit that an operating system can perform computational scheduling. It is included in the process and is the actual unit of operation in the process. A thread refers to a single sequential control flow in a process, multiple threads can be concurrently executed in a process, and each thread executes different tasks in parallel. The thread is used, tasks in the program which occupy a long time can be put into the background to be processed, and the running speed of the program is improved.
The number of the preset thread units can be the number of the divisible optimal threads, namely when a plurality of thread units of the number of the preset thread units work simultaneously, the working efficiency is not influenced mutually, and the working time can be effectively saved.
Comparing the number of the files with the number of the preset thread units, wherein the comparison result can comprise that the number of the files is greater than or equal to the number of the preset thread units, and the number of the files is less than the number of the preset thread units.
For example, the number of the preset thread units may be 5, the number of the files may be 8, and the number of the files is compared with the number of the preset thread units to obtain a comparison result: the number of the files is larger than or equal to the number of the preset thread units. The file set may be divided into 5, resulting in 5 sub-file sets.
After the number of the sub-file sets is determined, the files can be divided into the sub-file sets according to the sorting result of the files in the file sets. The dividing manner may be various, for example, the number of the subfile sets may be 5, and the subfile sets may be named A, B, C, D, E respectively. The number of files in the file set can be 8, and the files can be a, b, c, d, e, f, g and h according to the sorting result. File a may be divided into subset a, file B may be divided into subset B, file C may be divided into subset C, file D may be divided into subset D, file E may be divided into subset E, file f may be divided into subset a, file g may be divided into subset B, and file h may be divided into subset C.
For another example, the number of the preset thread units may be 5, the number of the files may be 3, and the number of the files is compared with the number of the preset thread units to obtain a comparison result: the file number is larger than the number of the preset thread units. The file set may be divided into 3 resulting in 3 sub-file sets.
After the number of the sub-file sets is determined, the files can be divided into the sub-file sets according to the sorting result of the files in the file sets. The dividing manner may be various, for example, the number of the subfile sets may be 3, and the subfile sets may be named as AA, BB, and CC, respectively. The number of files in the file set can be 3, and the number can be aa, bb and cc according to the sorting result. File AA may be partitioned into subset AA, file BB into subset BB, and file CC into subset CC. The file set is divided into the plurality of sub-sets, and the files in the file set are divided according to the preset sequence, so that the plurality of files can be processed simultaneously, and the working efficiency of the processor is improved.
103. And matching target thread units for the subfile sets, wherein the target thread units correspond to the subfile sets one by one.
In some embodiments, the step "matching target thread units for subfile sets" may include the following flows:
(21) determining the number of the sub-file sets;
(22) dividing the number of thread units according to the number;
(23) a target thread unit is determined based on the thread units and matched for the set of subfiles.
Specifically, after the number of the subfile sets is determined, the same number of thread units may be divided by the number of the subfile sets. For example, the number of subfile sets may be 3, and 3 thread units may be divided.
After the number of thread units is determined, one thread unit can be selected from the plurality of thread units as a target thread unit, and a subfile set can be matched for the target thread unit. The matching method may include multiple methods.
Specifically, the matching manner may be to determine a correspondence between the thread unit and the subfile set, and sort according to the correspondence. In some embodiments, the step of "determining a target thread unit based on the thread units and matching the target thread unit for the subfile set" may comprise the flow of:
(2311) sequencing the thread units to obtain a first sequencing result;
(2312) sequencing the sub-file sets to obtain a second sequencing result;
(2313) determining the corresponding relation between the first sequencing result and the second sequencing result;
(2314) and matching the corresponding target thread unit for the target subfile set according to the corresponding relation.
Specifically, the thread units are sequenced to obtain a first sequencing result. The thread units can be sorted according to the names of the thread units, and the names of the thread units can be numbers. For example, if the number of thread units is 5, the names of the 5 thread units may be: ccc, aaa, bbb, eee, ddd. Sorting according to the names can obtain a sorting result as follows: aaa, bbb, ccc, ddd, eee.
Specifically, the subfile sets are sorted to obtain a second sorting result. The sub-file sets can be sorted according to names of the sub-file sets, and names of the sub-file sets can be numbers. For example, if the number of the sub-file sets is 5, the names of the 5 sub-file sets may be: b. d, c, a, e. Sorting according to the names can obtain a sorting result as follows: a. b, c, d, e.
After the sorting result of the thread unit and the sorting result of the subfile set are determined, the corresponding relationship can be determined according to the sorting result of the thread unit and the sorting result of the subfile set.
For example, the ordering result of a thread unit may be: aaa, bbb, ccc, ddd, eee; the sorting result of the sub-file set may be a, b, c, d, e. Then the correspondence may be determined as: the thread unit aaa may correspond to the subfile set a, the thread unit bbb may correspond to the subfile set b, the thread unit ccc may correspond to the subfile set c, the thread unit ddd may correspond to the subfile set d, and the thread unit eee may correspond to the subfile set e. By acquiring the names of the thread units and the subfile sets and sequencing according to the names, a subfile set corresponding to each thread unit can be quickly determined.
In some embodiments, the step of "determining a target thread unit based on the thread units and matching the target thread unit for the subfile set" may comprise the following flows:
(2321) acquiring the processing rate of a thread unit;
(2322) acquiring the storage capacity occupied by the subfile set;
(2323) and matching the corresponding target thread unit for the subfile set according to the processing rate and the storage capacity.
Specifically, the processing rate of the thread unit is obtained, and the processing rate may be the file scanning capability of the thread unit.
The processing rate may be set for the thread unit when the thread unit is divided, for example, the thread unit may include a thread unit a, a thread unit b, and the like, and when the thread unit a is set, the processing rate of the thread unit a may be set to 10kb/s, and the processing rate of the thread unit b may be set to 8 kb/s.
After determining the processing rates of all thread units, all thread units are ordered based on the processing rates. There may be multiple ordering modes when ordering thread units. For example, the processing rates may be arranged in order from high to low. For example, if the thread units include a thread unit a with a processing rate of 10kb/s and a thread unit b with a processing rate of 8kb/s, the ordering result of the thread units can be determined as follows: thread unit a and thread unit b.
Specifically, the storage capacity occupied by the subfile set is obtained, and the storage capacity occupied by the subfile set is the memory space occupied by the subfile set in the terminal memory. For example, the subfile set may include a subfile set a, a subfile set B, and the like, the memory size of the subfile set a may be 1M, and the memory size of the subfile set B may be 2M.
And after the storage capacity occupied by all the subfile sets is obtained, sequencing the subfile sets based on the storage capacity. When sorting the set of sub-files, there may be a variety of sorting approaches. For example, the storage capacities of the subfile sets may be arranged in descending order. For example, the subfile set may include a subfile set a with a memory size of 1M and a subfile set B with a memory size of 2M, and the sorting result of the subfile set may be determined as follows: subfile set B, subfile set A.
After the sorting result of the thread unit and the sorting result of the subfile set are determined, the corresponding target thread unit can be matched for the subfile set according to the corresponding relation between the sorting result of the thread unit and the sorting result of the subfile set. For example, the ordering result of a thread unit may be: the thread unit a and the thread unit b, and the sorting result of the subfile set may be: the subfile set B and the subfile set A can be matched with the thread unit a for the subfile set B; thread unit b is matched for subfile set a.
Different subfile sets are processed according to the processing capacity of the thread unit, the maximum subfile set is processed by the fastest thread unit, and the processing speed of the thread unit can be improved.
104. A corresponding set of subfiles is scanned on a per target thread unit basis.
Specifically, after each thread unit is matched with each subfile set in the above manner, it can be determined that each thread unit corresponds to one subfile set. Wherein, a plurality of threads start to execute scanning operation at the same time, and each thread unit scans the subfile set matched with the thread unit.
For example, the thread unit aa may correspond to a subfile set a, which may include a file q, a file w, and a file e; the thread unit bb can correspond to a subfile set B, and the subfile set B can correspond to a file y and a file u; the thread unit cc may correspond to a subfile set C, which may include file g, file h, file j, etc. Specifically, after starting the file scanning operation, the thread processing unit aa scans the file q, the file w, and the file e; the thread processing unit bb scans the file y and the file u; the thread processing unit cc processes the file g, the file h, the file j, etc.
By starting the multiple threads and executing corresponding operations by the multiple threads at the same time, parallel processing scanning can be achieved, traversing scanning speed is increased, and updating speed of the media database is increased.
According to the scheme, a file scanning request is received, a file set is obtained according to the scanning request, files in the file set are divided, a plurality of subfile sets are obtained, the subfile sets are matched with target thread units, the target thread units correspond to the subfile sets one to one, and the corresponding subfile sets are scanned on the basis of each target thread unit. According to the scheme, the plurality of threads are divided, the scanning file is started simultaneously according to the plurality of threads, the processor is used for executing the scanning operation to the maximum extent, the file scanning time is saved, and the file scanning speed can be effectively improved.
Referring to fig. 2, fig. 2 is a schematic flowchart illustrating another file scanning method according to an embodiment of the present application. In this embodiment, the specific application scenarios of the file scanning method may be as follows:
201. and the user executes the starting operation on the terminal and triggers the terminal to receive the file scanning request.
In this embodiment, the user performs a booting operation on the terminal, and the terminal may be a mobile phone, a tablet computer, or other devices. The terminal can be in a power-off state, and the terminal can be powered on in various ways, for example, the terminal can be a mobile phone, and a user can perform power-on operation on the mobile phone by pressing a power key of the mobile phone for a long time.
After the terminal is turned on, that is, when the terminal is switched from the power-off state to the power-on state, the system automatically sends information for starting scanning, for example, the information may be an intent broadcast, the broadcast content may be "intent. At this time, the terminal is triggered to receive the file scanning request, and the terminal can start scanning the file in the memory.
202. And the terminal acquires the file set according to the file scanning request.
Specifically, the terminal acquires the file set after receiving the file scanning request. Wherein a file collection may be stored in the terminal memory, the file collection may comprise all folders in the terminal.
The file set may be displayed on the terminal interface in a list manner, as shown in fig. 4, where fig. 4 is a file display interface diagram of a file scanning method provided in the embodiment of the present application. Specifically, a user can check all files of the terminal by entering the terminal file management, such as a file display interface shown in fig. 4, which displays a file a, a file B, a file C, a file D, a file E, and a file F, where each file is displayed in a list form, the left side of the list is a file name, and an arrow on the right side of the list is an operation tool.
For example, as shown in fig. 4, file a, file B, file C, etc. may be file names, and an arrow corresponding to the right side of file a, and a user may click the arrow to operate on file a, and the operation may include viewing, editing, deleting, etc.
203. The terminal acquires file information in a file set and divides the file set into a plurality of sub-file sets according to the file information.
In this embodiment, after the terminal acquires the file set, all files in the file set may be determined. Further, the terminal obtains file information of all files, and the file information may include file names and the like.
The file set is divided according to the file name, and the specific dividing manner can be seen in the above operation steps, which is not described herein. After the file set is divided, a plurality of sub file sets can be obtained.
204. And the terminal acquires the number of the sub-file sets and divides a plurality of thread units according to the number of the sub-file sets.
After the file set is divided, one or more sub-file sets can be obtained, and then the number of thread units is determined according to the number of the sub-file sets. For example, the number of subfile sets may be 3, and the number of thread units may be 3.
The number of the thread units is determined according to the number of the subfile sets, so that the corresponding relation between the subfile sets and the thread units can be conveniently established.
205. The terminal matches each subfile set to a corresponding thread unit.
After the number of the subfile sets and the number of the thread units are determined, each subfile set can be matched with each thread unit, and the matching mode can include multiple modes. The specific matching implementation can be seen in the above operation steps, which are not described herein in detail.
206. And the terminal starts the scanning operation of each thread unit on the corresponding sub-file set.
Specifically, each thread unit is matched with a corresponding sub-file set. Multiple threads will be started and the scanning operation will be started, and each thread unit scans the subfile set matched with the thread unit. The thread unit scans the sub-file set, and can update the file information by reading the data content in the file database.
By starting a plurality of threads for processing at the same time, the scanning operation can be performed by utilizing the central processing unit to the maximum extent, and the speed is almost increased by multiple times compared with that of a single thread.
According to the scheme, a file scanning request is received, a file set is obtained according to the scanning request, files in the file set are divided, a plurality of subfile sets are obtained, the subfile sets are matched with target thread units, the target thread units correspond to the subfile sets one to one, and the corresponding subfile sets are scanned on the basis of each target thread unit. According to the scheme, the plurality of threads are divided, the scanning file is started simultaneously according to the plurality of threads, the processor is used for executing the scanning operation to the maximum extent, the file scanning time is saved, and the file scanning speed can be effectively improved.
In order to better implement the document scanning method provided by the embodiment of the present application, an embodiment of the present application further provides an apparatus based on the document scanning method. Wherein the meaning of the noun is the same as that in the above document scanning method, and the specific implementation details can refer to the description in the method embodiment.
Referring to fig. 3, fig. 3 is a block diagram of a file scanning apparatus according to an embodiment of the present disclosure, including:
a receiving unit 301, configured to receive a file scanning request, and obtain a file set according to the scanning request;
a dividing unit 302, configured to divide files in the file set to obtain multiple subfile sets;
a matching unit 303, configured to match a target thread unit for the subfile set, where the target thread unit corresponds to the subfile set one to one;
a scanning unit 304 for scanning the corresponding set of subfiles based on each of the target thread units.
In some embodiments, the dividing unit 302 may include:
the acquisition subunit is used for acquiring file information of the file, wherein the file information at least comprises a file name;
the sorting subunit is used for sorting the files according to the file names to obtain a third sorting result;
and the first dividing unit is used for determining the file number of the file and dividing the file based on the file number and the sorting result.
In some embodiments, the first molecular unit is specifically configured to: comparing the number of the files with the number of preset thread units; if the number of the files is smaller than the number of the preset thread units, dividing the file set into sub-file sets of the number of the files, and determining the files in the sub-file sets according to the third sequencing result; if the number of the files is larger than or equal to the number of the preset thread units, dividing the file set into sub-file sets with the number of the preset thread units, and determining the files in the sub-file sets according to the third sequencing result.
In some embodiments, the matching unit 303 may include:
a determining subunit, configured to determine the number of the subfile sets;
a second dividing subunit, configured to divide the number of thread units according to the number;
and the matching subunit is used for determining a target thread unit based on the thread unit and matching the target thread unit for the subfile set.
In some embodiments, the matching subunit is specifically configured to: sequencing the thread units to obtain a first sequencing result; sequencing the sub file sets to obtain a second sequencing result; determining a corresponding relation between the first sorting result and the second sorting result; and matching the corresponding target thread unit for the target subfile set according to the corresponding relation.
In some embodiments, the matching subunit is specifically configured to: acquiring the processing rate of the thread unit; acquiring the storage capacity occupied by the subfile set; and matching corresponding target thread units for the subfile sets according to the processing rate and the storage capacity.
In some embodiments, the document scanning device may further include:
the trigger unit is used for triggering a file scanning instruction when detecting that the terminal is switched from a shutdown state to a startup state;
and the sending unit is used for sending a scanning request through the scanning instruction.
According to the scheme, a file scanning request is received, a file set is obtained according to the scanning request, files in the file set are divided, a plurality of subfile sets are obtained, the subfile sets are matched with target thread units, the target thread units correspond to the subfile sets one to one, and the corresponding subfile sets are scanned on the basis of each target thread unit. According to the scheme, the plurality of threads are divided, the scanning file is started simultaneously according to the plurality of threads, the processor is used for executing the scanning operation to the maximum extent, the file scanning time is saved, and the file scanning speed can be effectively improved.
The embodiment of the application also provides a terminal. As shown in fig. 5, the terminal may include Radio Frequency (RF) circuitry 601, memory 602 including one or more computer-readable storage media, input unit 603, output unit 604, sensor 605, audio circuitry 606, Wireless Fidelity (WiFi) module 607, processor 608 including one or more processing cores, and power supply 609. Those skilled in the art will appreciate that the terminal structure shown in fig. 5 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
the RF circuit 601 may be used for receiving and transmitting signals during the process of transmitting and receiving information, and in particular, for processing the received downlink information of the base station by one or more processors 608; in addition, data relating to uplink is transmitted to the base station. In general, the RF circuit 601 includes, but is not limited to, an antenna, at least one Amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, the RF circuit 601 may also communicate with networks and other devices via wireless communications.
The memory 602 may be used to store software programs and modules, and the processor 608 executes various functional applications and data processing by operating the software programs and modules stored in the memory 602. The memory 602 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function (such as a sound playing function, an image playing function, etc.), and the like. Further, the memory 602 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 602 may also include a memory controller to provide the processor 608 and the input unit 603 access to the memory 602.
The input unit 603 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control. In particular, in one particular embodiment, input unit 603 may include a touch-sensitive surface as well as other input devices. The touch-sensitive surface, also referred to as a touch display screen or a touch pad, may collect touch operations by a user (e.g., operations by a user on or near the touch-sensitive surface using a finger, a stylus, or any other suitable object or attachment) thereon or nearby, and drive the corresponding connection device according to a predetermined program. The input unit 603 may include other input devices in addition to the touch-sensitive surface. In particular, other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The output unit 604 may be used to display information input by or provided to the user and various graphical user interfaces of the server, which may be made up of graphics, text, icons, video, and any combination thereof. The output unit 604 may include a display panel, and optionally, the display panel may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch-sensitive surface may overlay the display panel, and when a touch operation is detected on or near the touch-sensitive surface, the touch operation is transmitted to the processor 608 to determine the type of touch event, and the processor 608 then provides a corresponding visual output on the display panel according to the type of touch event. Although in FIG. 5 the touch-sensitive surface and the display panel are two separate components to implement input and output functions, in some embodiments the touch-sensitive surface may be integrated with the display panel to implement input and output functions.
The terminal may also include at least one sensor 605, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that adjusts the brightness of the display panel according to the brightness of ambient light, and a proximity sensor that turns off the display panel and the backlight when the server moves to the ear.
Audio circuitry 606, speakers, and microphones may provide an audio interface between the user and the server. The audio circuit 606 may transmit the electrical signal converted from the received audio data to a speaker, and convert the electrical signal into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 606 and converted into audio data, which is then processed by the audio data output processor 608, and then passed through the RF circuit 601 to be sent to, for example, a terminal, or the audio data is output to the memory 602 for further processing. The audio circuitry 606 may also include an ear-bud jack to provide communication of peripheral headphones with the server.
WiFi belongs to short-distance wireless transmission technology, and the terminal can help a user to receive and send e-mails, browse webpages, access streaming media and the like through the WiFi module 607, and provides wireless broadband internet access for the user. Although fig. 5 shows the WiFi module 607, it is understood that it does not belong to the essential constitution of the terminal, and may be omitted entirely as needed within the scope of not changing the essence of the application.
The processor 608 is a control center of the terminal, connects various parts of the entire handset using various interfaces and lines, and performs various functions of the server and processes data by operating or executing software programs and modules stored in the memory 602 and calling data stored in the memory 602, thereby performing overall monitoring of the handset. Optionally, processor 608 may include one or more processing cores; preferably, the processor 608 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 608.
The terminal also includes a power supply 609 (e.g., a battery) for powering the various components, which may preferably be logically connected to the processor 608 via a power management system that may be used to manage charging, discharging, and power consumption. The power supply 609 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
Specifically, in this embodiment, the processor 608 in the terminal loads the executable file corresponding to the process of one or more application programs into the memory 602 according to the following instructions, and the processor 608 runs the application programs stored in the memory 602, thereby implementing various functions:
receiving a file scanning request, and acquiring a file set according to the scanning request;
dividing the files in the file set to obtain a plurality of sub-file sets;
matching target thread units for the subfile sets, wherein the target thread units correspond to the subfile sets one by one;
scanning the respective set of subfiles based on each of the target thread units.
According to the scheme, a file scanning request is received, a file set is obtained according to the scanning request, files in the file set are divided, a plurality of subfile sets are obtained, the subfile sets are matched with target thread units, the target thread units correspond to the subfile sets one to one, and the corresponding subfile sets are scanned on the basis of each target thread unit. According to the scheme, the plurality of threads are divided, the scanning file is started simultaneously according to the plurality of threads, the processor is used for executing the scanning operation to the maximum extent, the file scanning time is saved, and the file scanning speed can be effectively improved.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, embodiments of the present application provide a computer-readable storage medium, in which a plurality of instructions are stored, where the instructions can be loaded by a processor to execute the steps in any one of the file scanning methods provided in the embodiments of the present application. For example, the instructions may perform the steps of:
receiving a file scanning request, acquiring a file set according to the scanning request, dividing files in the file set to obtain a plurality of subfile sets, matching target thread units for the subfile sets, wherein the target thread units are in one-to-one correspondence with the subfile sets, and scanning the corresponding subfile sets based on each target thread unit.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Wherein the computer-readable storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
Since the instructions stored in the computer-readable storage medium can execute the steps in any file scanning method provided in the embodiments of the present application, beneficial effects that can be achieved by any file scanning method provided in the embodiments of the present application can be achieved, for details, see the foregoing embodiments, and are not described herein again.
The document scanning method, the document scanning device, the computer-readable storage medium, and the terminal provided in the embodiments of the present application are described in detail above, and a specific example is applied in the present application to explain the principles and embodiments of the present application, and the description of the above embodiments is only used to help understand the method and the core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A method of scanning a document, comprising:
receiving a file scanning request, and acquiring a file set according to the scanning request;
dividing the files in the file set to obtain a plurality of sub-file sets;
matching target thread units for the subfile sets, wherein the target thread units correspond to the subfile sets one by one;
scanning the respective set of subfiles based on each of the target thread units.
2. The method of claim 1, wherein matching the target thread unit for the subfile set comprises:
determining a number of the subfile sets;
dividing the number of thread units according to the number;
a target thread unit is determined based on the thread units and matched for the set of subfiles.
3. The method of claim 2, wherein determining a target thread unit based on the thread units and matching the target thread unit for the set of subfiles comprises:
sequencing the thread units to obtain a first sequencing result;
sequencing the sub file sets to obtain a second sequencing result;
determining a corresponding relation between the first sorting result and the second sorting result;
and matching the corresponding target thread unit for the target subfile set according to the corresponding relation.
4. The method of claim 2, wherein determining a target thread unit based on the thread units, the target thread unit being matched for the sub-file set, comprises:
acquiring the processing rate of the thread unit;
acquiring the storage capacity occupied by the subfile set;
and matching corresponding target thread units for the subfile sets according to the processing rate and the storage capacity.
5. The method of claim 1, wherein the dividing the files in the set of files comprises:
acquiring file information of the file, wherein the file information at least comprises a file name;
sorting the files according to the file names to obtain a third sorting result;
and determining the file number of the file, and dividing the file based on the file number and the sorting result.
6. The method of claim 5, wherein the dividing the file based on the number of files and the sorting result comprises:
comparing the number of the files with the number of preset thread units;
if the number of the files is smaller than the number of the preset thread units, dividing the file set into sub-file sets of the number of the files, and determining the files in the sub-file sets according to the third sequencing result;
if the number of the files is larger than or equal to the number of the preset thread units, dividing the file set into sub-file sets with the number of the preset thread units, and determining the files in the sub-file sets according to the third sequencing result.
7. The method of claim 1, further comprising:
when detecting that the terminal is switched from a power-off state to a power-on state, triggering a file scanning instruction;
and sending a scanning request through the scanning instruction.
8. A document scanning apparatus, comprising:
the receiving unit is used for receiving a file scanning request and acquiring a file set according to the scanning request;
the dividing unit is used for dividing the files in the file set to obtain a plurality of sub-file sets;
the matching unit is used for matching a target thread unit for the subfile set, and the target thread unit corresponds to the subfile set one by one;
a scanning unit for scanning the respective subfile set based on each of the target thread units.
9. A computer readable storage medium storing instructions adapted to be loaded by a processor to perform the steps of the document scanning method according to any of claims 1 to 7.
10. A terminal comprising a processor and a memory, said memory storing a plurality of instructions, said processor loading said instructions to perform the steps of the document scanning method of any of claims 1 to 7.
CN201910902872.XA 2019-09-24 2019-09-24 File scanning method and device, computer readable storage medium and terminal Pending CN110688344A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910902872.XA CN110688344A (en) 2019-09-24 2019-09-24 File scanning method and device, computer readable storage medium and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910902872.XA CN110688344A (en) 2019-09-24 2019-09-24 File scanning method and device, computer readable storage medium and terminal

Publications (1)

Publication Number Publication Date
CN110688344A true CN110688344A (en) 2020-01-14

Family

ID=69109958

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910902872.XA Pending CN110688344A (en) 2019-09-24 2019-09-24 File scanning method and device, computer readable storage medium and terminal

Country Status (1)

Country Link
CN (1) CN110688344A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112286917A (en) * 2020-10-22 2021-01-29 北京锐安科技有限公司 Data processing method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070179973A1 (en) * 2006-01-30 2007-08-02 Microsoft Corporation Status tool to expose metadata read and write queues
CN103841196A (en) * 2014-03-07 2014-06-04 长沙裕邦软件开发有限公司 File uploading system and method based on multithreading
CN105550195A (en) * 2015-10-27 2016-05-04 深圳市美贝壳科技有限公司 Method for rapidly reading and writing Android system media library data
CN108874894A (en) * 2018-05-21 2018-11-23 平安科技(深圳)有限公司 Crosstab deriving method, device, computer equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070179973A1 (en) * 2006-01-30 2007-08-02 Microsoft Corporation Status tool to expose metadata read and write queues
CN103841196A (en) * 2014-03-07 2014-06-04 长沙裕邦软件开发有限公司 File uploading system and method based on multithreading
CN105550195A (en) * 2015-10-27 2016-05-04 深圳市美贝壳科技有限公司 Method for rapidly reading and writing Android system media library data
CN108874894A (en) * 2018-05-21 2018-11-23 平安科技(深圳)有限公司 Crosstab deriving method, device, computer equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112286917A (en) * 2020-10-22 2021-01-29 北京锐安科技有限公司 Data processing method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US10635449B2 (en) Method and apparatus for running game client
US10069818B2 (en) Method, system, device, and terminal for network initialization of multimedia playback device
CN107273160A (en) A kind of method and device of edition upgrading
CN104965641B (en) information display method and device
US20190034443A1 (en) Data Processing Method and Device
CN106502703B (en) Function calling method and device
CN106708554B (en) Program operating method and device
CN108156508B (en) Barrage information processing method and device, mobile terminal, server and system
CN107436948B (en) File searching method and device and terminal
CN103455330A (en) Application program management method, terminal, equipment and system
WO2018006841A1 (en) Qr code information transmission method, device and apparatus
CN114185491B (en) Partition file downloading method and device, storage medium and computer equipment
CN108388451A (en) Method for starting up mobile terminal, device and mobile terminal
CN106502833B (en) Data backup method and device
CN104660769B (en) A kind of methods, devices and systems for adding associated person information
CN110944318B (en) Lock card setting method and device, storage medium and terminal
CN106682189B (en) File name display method and device
CN105550316A (en) Pushing method and device of audio list
CN104102560A (en) Method and device for testing system performance
CN106303616B (en) Play control method, device and terminal
CN110688344A (en) File scanning method and device, computer readable storage medium and terminal
WO2020010995A1 (en) Icon arrangement method and apparatus, and readable storage medium and mobile terminal
CN111262737A (en) Port configuration management method and device, storage medium and terminal
CN104954231B (en) Method and device for sending and displaying recommendation information
WO2015067206A1 (en) File searching method and terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200114