CN112306959A - File scanning method of mobile storage device, storage medium and device terminal - Google Patents

File scanning method of mobile storage device, storage medium and device terminal Download PDF

Info

Publication number
CN112306959A
CN112306959A CN202011197119.4A CN202011197119A CN112306959A CN 112306959 A CN112306959 A CN 112306959A CN 202011197119 A CN202011197119 A CN 202011197119A CN 112306959 A CN112306959 A CN 112306959A
Authority
CN
China
Prior art keywords
directory
scanning
files
file
directories
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.)
Granted
Application number
CN202011197119.4A
Other languages
Chinese (zh)
Other versions
CN112306959B (en
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.)
Guangzhou Lango Electronic Science and Technology Co Ltd
Original Assignee
Guangzhou Lango Electronic Science and Technology 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 Guangzhou Lango Electronic Science and Technology Co Ltd filed Critical Guangzhou Lango Electronic Science and Technology Co Ltd
Priority to CN202011197119.4A priority Critical patent/CN112306959B/en
Publication of CN112306959A publication Critical patent/CN112306959A/en
Application granted granted Critical
Publication of CN112306959B publication Critical patent/CN112306959B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/13File access structures, e.g. distributed indices
    • 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/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • 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/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The invention discloses a file scanning method of mobile storage equipment, which comprises the steps of acquiring the total number of files and directories under a root directory of the mobile storage equipment, and dividing all the files and directories under the current directory into two parts; scanning depth +1, respectively scanning files in a positive sequence mode and a reverse sequence mode, and respectively storing the scanned files and directories in a first cache queue and a second cache queue; sending all files in the first cache queue to a database of the equipment terminal for classification; for the second cache queue, sequentially taking out each directory from the second cache queue according to the priority of the directory and recording the directory as a current directory, and then executing the steps of dividing and scanning; until the directory in the second buffer queue is empty. The invention can greatly shorten the file scanning time, and simultaneously brings good experience to the user by quickly responding to the operation. The invention also provides a storage medium and an android device terminal.

Description

File scanning method of mobile storage device, storage medium and device terminal
Technical Field
The present invention relates to file scanning, and in particular, to a file scanning method for a mobile storage device, a storage medium, and a mobile device terminal.
Background
For mobile storage devices such as a U disk and a mobile hard disk, the number of fragmented files is large, and the hierarchy of a directory structure where the files are located is too deep. When a mobile storage device such as a U disk and a mobile hard disk is inserted into an android device terminal, a system of the android device terminal firstly needs to scan all files stored in the mobile storage device and then classify the files. Due to the fact that the number of files is large, scanning of the mobile storage device usually needs a long time to complete, and bad experience is brought to users.
Disclosure of Invention
In order to overcome the defects of the prior art, an object of the present invention is to provide a file scanning method for a mobile storage device, which can solve the problems that in the prior art, an android device terminal scans files of an accessed mobile storage device for too long time, which brings poor experience to a user, and the like.
The second purpose of the present invention is to provide a storage medium, which can solve the problems that in the prior art, an android device terminal scans files of an accessed mobile storage device for too long time, which brings bad experience to a user, and the like.
The invention further aims to provide an android device terminal, which can solve the problems that in the prior art, the android device terminal has too long file scanning time of an accessed mobile storage device, and bad experience is brought to a user.
One of the purposes of the invention is realized by adopting the following technical scheme:
a file scanning method of a mobile storage device is applied to a device terminal provided with an android system, and the device terminal is connected with the mobile storage device; the method comprises the following steps:
an identification step: when the device terminal detects and identifies the access of the mobile storage device, acquiring a root directory of the mobile storage device and the total number of files and directories under the root directory; meanwhile, setting the scanning depth to be 0, and recording the root directory of the mobile storage device as a current directory;
dividing: dividing all files and directories under the current directory into a first part and a second part according to a preset rule;
a scanning step: scanning the depth +1, and respectively scanning the files and the directories in the first part in a positive sequence and scanning the files and the directories in the second part in a reverse sequence; the positive sequence is the positive arrangement sequence of all files and directories under the current directory, and the reverse sequence is opposite to the positive sequence;
a first storage step: storing the scanned files in a first cache queue and storing the scanned directories in a second cache queue;
a classification step: when the number of the files in the first cache queue reaches a first preset value, all the files in the first cache queue are sent to a database of the equipment terminal, and all the files are classified according to file types;
and (3) circulating step: after the first part and the second part are scanned, sequentially taking out each directory from the second cache queue according to the priority of the directory and recording the directory as a current directory, and then executing a dividing step and a scanning step; until the directory in the second buffer queue is empty.
Further, the scanning step further comprises: judging whether the scanning depth is greater than a preset depth, if not, executing a first storage step; if yes, executing a second storage step;
the second storing step: and storing the scanned file in a first cache queue and storing the scanned directory in a third cache queue.
Further, when the directory in the second cache queue is empty and the directory of the third cache queue is not empty, clearing the scanning depth, then sequentially taking out each directory from the third cache queue according to the priority of the directory and recording the directory as the current directory, and executing the dividing step and the scanning step; until the directory in the third cache queue is empty; at this time, when the directories in the second cache queue are not empty, sequentially taking out one directory from the second cache queue according to the priority of the directory to be recorded as a current directory, and executing a dividing step and a scanning step until the directories in the second cache queue are empty;
and when the directories in the second buffer queue and the third buffer queue are empty, finishing the scanning.
Further, the method also comprises a pause step: when the number of the directories in the second cache queue reaches a second preset value, recording the number of the currently scanned file of the first part, the number of the currently scanned file of the second part and the current scanning depth;
then sequentially taking out each directory from the current second cache queue according to the priority of the directory and recording the directory as the current directory, and then executing a dividing step and a scanning step; and continuing to scan the rest part in the first part corresponding to the current scanning depth according to the currently scanned file number of the first part and the current scanning depth until the directory in the current second cache queue is empty, and continuing to scan the rest part in the second part corresponding to the current scanning depth according to the currently scanned file number of the second part and the current scanning depth.
Further, still include: a display step: and displaying the classified files to a user through an interface according to the file types.
Further, the displaying step further comprises: and updating the number of the files of each file type in the interface after receiving the files in the second cache queue and classifying the files each time.
Further, the scanning step further comprises: and acquiring a first thread and a second thread from the thread pool, scanning the files and the directories of the first part in a forward order through the first thread, and scanning the files and the directories of the second part in a reverse order through the second thread.
Further, the number of all files and directories in the first part is half of that of all files and directories under the current directory.
The second purpose of the invention is realized by adopting the following technical scheme:
a storage medium which is a computer-readable storage medium having stored thereon a file scanning program which is a computer program, which when executed by a processor implements the steps of a file scanning method of a mobile storage device as employed in one of the objects of the present invention.
The third purpose of the invention is realized by adopting the following technical scheme:
the android device terminal is provided with a USB interface, is connected with a mobile storage device through the USB interface, and is used for scanning and displaying files in the mobile storage device by executing a file scanning method of the mobile storage device adopted by one of the purposes of the invention when the mobile storage device is detected.
Compared with the prior art, the invention has the beneficial effects that:
the files and the directories under the directories of the mobile storage equipment are divided into two parts by adopting a dichotomy division method, the two parts are respectively and simultaneously scanned, and then the scanned files and the sub-directories are respectively stored in the corresponding cache queues, so that when the number of the scanned files reaches a certain preset value, the scanned files are classified and timely displayed to a user, and the user can check the scanning result in time; and meanwhile, dividing and scanning the scanned subdirectories again in a layered mode until all the subdirectories are scanned completely, and finishing the file scanning of the mobile storage equipment. According to the invention, the time for scanning the files can be greatly shortened by adopting a dichotomy and a layered scanning mode, and meanwhile, the number of the files scanned to a certain preset value is displayed to the user in time, so that the user can view the scanned files in a short time, and the user experience is improved.
Drawings
FIG. 1 is a data flow diagram of an android device terminal when executing a file scanning method of a mobile storage device according to the present invention;
FIG. 2 is a flowchart of a file scanning method of a mobile storage device according to the present invention;
FIG. 3 is a flowchart illustrating a scanning depth greater than a predetermined depth in the document scanning method according to the present invention;
FIG. 4 is a flowchart illustrating a process of determining when the number of directories in the second buffer queue reaches a second preset value according to the file scanning method of the present invention;
FIG. 5 is a block diagram of a file scanning apparatus of a mobile storage device according to the present invention.
In the figure: 11. a memory; 12. a processor; 13. a communication bus; 14. a network interface.
Detailed Description
The present invention will be further described with reference to the accompanying drawings and the detailed description, and it should be noted that any combination of the embodiments or technical features described below can be used to form a new embodiment without conflict.
Example one
The invention provides a file scanning method of a mobile storage device, which is applied to a device terminal provided with an android system.
Preferably, the mobile storage device in this embodiment may be a common usb disk, a mobile hard disk, or other various storage devices. The device terminal equipped with the android system in this embodiment is generally a mobile device terminal equipped with the android system.
The mobile storage device and the device terminal can be connected through a USB interface, and certainly, the mobile storage device and the device terminal are not limited to be connected through a USB interface, and can also be connected through other interface modes.
As shown in fig. 1, when the device terminal detects that the mobile storage device is accessed, the device terminal automatically initiates a file scanning instruction for the mobile storage device, and enters a data analysis layer and a UI display layer. The data analysis layer is used for managing threads for scanning, storing scanning modes of files and scanning results and the like, and the UI display layer is used for displaying the classified scanning results.
The invention can solve the problems of low file scanning speed and the like of the mobile storage device after the mobile storage device is accessed into the mobile device terminal in the prior art, and realizes the quick scanning of the file by a layered scanning and incremental display method, thereby greatly improving the scanning speed of the file and bringing good visual experience to users.
As shown in fig. 2 to 4, the present invention provides a preferred embodiment, a file scanning method of a mobile storage device, which specifically includes the following steps:
step S1, when the device terminal detects and identifies the access of the mobile storage device, acquiring the root directory of the mobile storage device and the total number of files and directories under the root directory, and setting the scanning depth to 0. The files include files in various formats, such as text document files, word document files, compressed files, excel files, PPT files, program files, and the like. Directories, also referred to as folders, may further include files and other folders for distinguishing from files, and directories are used herein as folders. The invention provides a new file scanning method for solving the problem of low file scanning speed in the prior art by scanning all files in the mobile storage device and displaying the files after classification, which can greatly shorten the scanning time and bring good experience to users.
Suppose that the total number of files and directories under the root directory of the mobile storage device is set to be N. Where N refers to the sum of the number of all files and the number of all directories under the root directory.
For example, the root directory of the mobile storage device is root, the files under the root directory include a1 files and B2 files, the directories include a B1 directory, an a2 directory and a C3 directory, and N is 5.
Suppose that the files and the directories in the root directory root are ordered according to names, specifically:
the files of the a1 are described,
the directory of the a2 is,
the B1 list of the contents is,
the B2 file is a file that,
c3 directory.
Preferably, the scanning depth refers to the depth of the directory hierarchy in which the currently scanned directory or file is located. For example, when scanning a file or a directory under the root directory root, the current scanning depth is considered to be 1.
Preferably, assuming that the root directory of the mobile storage device is set as the current directory,
step S2, recording the root directory of the mobile storage device as the current directory, and then dividing all the files and directories of the root in the current directory into two parts, which are respectively recorded as the first part and the second part. The current in this embodiment refers to the directory to be scanned.
And the sum of the total number of the files and the directories in the first part and the total number of the files and the directories in the second part is equal to N.
Preferably, the present embodiment uses a binary averaging method to divide the files and directories under the directory to be scanned. That is, the number of files and directories in the first portion is half of the total number of files and directories under the current directory.
Preferably, in order to facilitate the scanning, all the files and directories under the root directory of the mobile storage device are further divided in sequence according to the arrangement order of the files and directories in this embodiment. That is, after the files or directories are numbered according to the arrangement order of the files and directories, the files and directories in the first portion include 1 st to N1 th files or directories, and the files and directories in the second portion include N1+1 th to N th files or directories. Wherein, N1 is N/2.
For example, for the root directory root, the first part includes an a1 file and an a2 directory, and the second part includes a B1 directory, a B2 file and a C3 directory.
Step S3, scan depth +1, and scan the files and directories in the first part in forward order and the files and directories in the second part in reverse order, respectively.
The forward sequence in this embodiment refers to the forward arrangement sequence of the files and directories under the current directory, and the reverse sequence is opposite to the forward sequence. For example, the scan order for the first section is A1- > A2, and the scan order for the second section is B1- > B2- > C3.
Step S4, storing the scanned file in the first buffer queue, and storing the directory in the second buffer queue.
The file and directory storage method and the device adopt a queue mode to store files and directories, and set files or directories with low depth and high priority. Thus, the files or directories with lower depth are firstly put into the queue, and the files or directories with higher depth are then put into the queue, so that the files or directories with lower depth are preferentially taken out for scanning in the next scanning.
In order to display the scanning result to the user in time, the invention is also realized by an increment display method. That is, step S5 is further included: in the scanning process, whether the number of the files in the first cache queue meets a first preset value or not is judged in real time, if yes, the files in the first cache queue are taken out and sent to a database of the equipment terminal, so that the database classifies the files according to file types, and then the classified files are displayed to a user according to the file types.
Then, in the scanning process, when the number of the files in the first cache queue meets a first preset value every time, the files are taken out and sent to the database to realize classification, and after the classification is finished every time, the files of each file type shown to the user in the interface, including file information, the number of the files and the like, are updated in real time.
Step S6, after the first part and the second part are scanned, sequentially taking out a directory from the second cache queue according to the priority of the directory and recording the directory as a current directory, and then circularly executing step S2 and step S3; until the directory in the second buffer queue is empty.
Since the directories are stored in the second cache queue every time of scanning, each directory is sequentially taken out from the second cache queue according to the priority of the directory, and then the directory is divided in the step S2 and scanned in the step S3, so that each directory is scanned until no directory exists in the second cache queue, that is, the file scanning of the mobile storage device is completed.
Preferably, the priority of the directory in this embodiment is determined according to the depth of the directory. The smaller the depth of the directory in this embodiment is, the higher the priority thereof is; conversely, the lower the priority.
In addition, because the number of files of the mobile storage device is large, the directory hierarchy is deep, and the storage space of the second cache queue is limited, the invention also comprises the following steps:
as shown in fig. 3, step S3 further includes: after the scanning depth is plus 1, judging whether the scanning depth is greater than the preset depth, if not, executing the step S4; if yes, go to step S41.
And step S41, storing the scanned files in a first cache queue and storing the scanned directories in a third cache queue.
By temporarily storing the directory with a deeper directory structure hierarchy in the third cache queue, the problem that the scanned directory cannot be stored and is lost due to the limited storage space of the second cache queue is avoided.
Preferably, the number of the cache queues for the directory may be two in this embodiment, or three, four, etc. may be set according to actual requirements, and this is achieved by setting each threshold of the scanning depth.
Preferably, this embodiment further includes:
and step S7, when the directory in the second buffer queue is empty and the directory in the third buffer queue is not empty, clearing the scanning depth, and then executing step S8.
And step S8, sequentially taking out one directory from the third cache queue according to the priority of the directory and recording the directory as the current directory, and executing step S2 and step S3 until the directory in the third cache queue is empty.
Because the directory in the second buffer queue has a higher priority and the directory in the third buffer queue has a lower priority, during scanning, the directory in the second buffer queue is scanned first, and then the directory in the third buffer queue is scanned, so that when the directories in the second buffer queue and the third buffer queue are empty, the scanning is considered to be finished.
In addition, when the directory in the third buffer queue in step S8 is empty, that is, after the scanning of the directory in the third buffer queue is completed, the scanning depth is cleared in step S7, and each directory in the third buffer queue is scanned, at this time, the scanned directory is stored in the second buffer queue in advance.
Therefore, when the directory in the third buffer queue is empty, the directory in the second buffer queue may not be empty, and therefore, when the directory in the third buffer queue is empty and the directory in the second buffer queue is not empty, it is further required to continue to sequentially take out a directory from the second buffer queue according to the priority of the directory and use the directory as the current directory, and then execute step S2 and step S3 until the directory in the second buffer queue is empty.
In addition, when the directories in the third cache queue are scanned, the scanned directories are stored in the second cache queue when the scanning depth is smaller than the preset scanning depth, and the scanned directories are stored in the third cache queue when the scanning depth is larger than the preset scanning depth.
Therefore, according to the above-mentioned loop process, when the directory in the second buffer queue is empty and the directory in the third buffer queue is not empty, the directory in the third buffer queue is scanned until the directory in the third buffer queue is empty.
And when the directory in the third cache queue is empty and the directory in the second cache queue is not empty, scanning the directory in the second cache queue.
And when the directories in the third buffer queue and the second buffer queue are empty, considering that all the directories of the mobile storage device are scanned completely, and finishing the scanning.
Preferably, when the storage space in the second buffer queue is insufficient, another preferred embodiment is further provided in the present invention, as shown in fig. 4:
and step S9, when the number of the directories in the second cache queue reaches a second preset value, recording the number of the currently scanned file of the first part, the number of the currently scanned file of the second part and the current scanning depth.
Step S10, sequentially taking out a directory from the current second cache queue according to the priority of the directory to be recorded as a current directory, and then executing a dividing step and a scanning step; until the directory in the current second buffer queue is empty.
Step S11, continuing to scan the remaining part in the first portion corresponding to the current scanning depth according to the currently scanned file number and the current scanning depth of the first portion, and continuing to scan the remaining part in the second portion corresponding to the current scanning depth according to the currently scanned file number and the current scanning depth of the second portion.
That is, if the storage space in the second cache queue is full, the current scanning is suspended, the scanning nodes of the first part and the second part are recorded, then the directory in the current second cache queue is scanned, and when the directory in the second cache queue is empty, the scanning of the remaining parts of the first part and the second part is continued according to the scanning nodes recording the first part and the second part.
In this embodiment, the problem of insufficient storage space in the second buffer queue is solved in a suspension manner, and the scanned directory is prevented from being lost due to insufficient storage space in the second buffer queue.
The invention accelerates the speed of scanning the file of the accessed mobile storage device by the device terminal, greatly shortens the file scanning time, increases a very quick response mode and incremental display classification on the display, reduces the resource consumption, enables the user to quickly respond and operate and brings good experience to the user.
Based on the file scanning method of the mobile storage device provided by the invention, the invention also provides a file scanning device of the mobile storage device. As shown in fig. 5, an internal structure of a file scanning apparatus of a mobile storage device according to an embodiment of the present invention is schematically illustrated.
In this embodiment, the file scanning apparatus of a mobile storage device may be a PC (Personal Computer), or may also be a terminal device such as a smart phone, a tablet Computer, or a portable Computer. The file scanning device of the mobile storage device at least comprises: a processor 12, a communication bus 13, a network interface 14, and a memory 11.
The memory 11 includes at least one type of readable storage medium, which includes a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, and the like. The memory 11 may in some embodiments be an internal storage unit of a file scanning apparatus of a mobile storage device, such as a hard disk of the file scanning apparatus of the mobile storage device. The memory 11 may also be an external storage device of a file scanning apparatus of a mobile storage device in other embodiments, such as a plug-in hard disk provided on a file scanning apparatus of a mobile storage device, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and so on.
Further, the memory 11 may also include both an internal storage unit and an external storage device of the file scanning apparatus of a mobile storage device. The memory 11 may be used not only to store application software installed in a file scanning apparatus of a mobile storage device and various types of data, such as a code of a file scanning program, etc., but also to temporarily store data that has been output or will be output.
The processor 12 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor or other data Processing chip in some embodiments, and is used for executing program codes stored in the memory 11 or Processing data, such as executing a file scanning program.
The communication bus 13 is used to realize connection communication between these components.
The network interface 14 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), and is typically used to establish a communication link between the file scanning apparatus of the mobile storage device and other electronic devices.
Optionally, the file scanning apparatus of the mobile storage device may further include a user interface, the user interface may include a Display (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface may further include a standard wired interface and a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable for displaying information processed in a file scanning apparatus of a mobile storage device and for displaying a visualized user interface.
While FIG. 5 shows only one type of file scanning apparatus of a mobile storage device having components 11-14 and a file scanning program, those skilled in the art will appreciate that the configuration shown in FIG. 5 does not constitute a limitation of a file scanning apparatus of a mobile storage device and may include fewer or more components than shown, or some components in combination, or a different arrangement of components.
In the embodiment of the file scanning apparatus of a mobile storage device shown in fig. 5, a file scanning program is stored in the memory 11; the processor 12, when executing the file scanning program stored in the memory 11, implements the following steps:
an identification step: when the device terminal detects and identifies the access of the mobile storage device, acquiring a root directory of the mobile storage device and the total number of files and directories under the root directory; meanwhile, setting the scanning depth to be 0, and recording the root directory of the mobile storage device as a current directory;
dividing: dividing all files and directories under the current directory into a first part and a second part according to a preset rule;
a scanning step: scanning the depth +1, and respectively scanning the files and the directories in the first part in a positive sequence and scanning the files and the directories in the second part in a reverse sequence; the positive sequence is the positive arrangement sequence of all files and directories under the current directory, and the reverse sequence is opposite to the positive sequence;
a first storage step: storing the scanned files in a first cache queue and storing the scanned directories in a second cache queue;
a classification step: when the number of the files in the first cache queue reaches a first preset value, all the files in the first cache queue are sent to a database of the equipment terminal, and all the files are classified according to file types;
and (3) circulating step: after the first part and the second part are scanned, sequentially taking out each directory from the second cache queue according to the priority of the directory and recording the directory as a current directory, and then executing a dividing step and a scanning step; until the directory in the second buffer queue is empty.
Further, the scanning step further comprises: judging whether the scanning depth is greater than a preset depth, if not, executing a first storage step; if yes, executing a second storage step;
the second storing step: and storing the scanned file in a first cache queue and storing the scanned directory in a third cache queue.
Further, when the directory in the second cache queue is empty and the directory of the third cache queue is not empty, clearing the scanning depth, then sequentially taking out each directory from the third cache queue according to the priority of the directory and recording the directory as the current directory, and executing the dividing step and the scanning step; until the directory in the third cache queue is empty; at this time, when the directories in the second cache queue are not empty, sequentially taking out one directory from the second cache queue according to the priority of the directory to be recorded as a current directory, and executing a dividing step and a scanning step until the directories in the second cache queue are empty;
and when the directories in the second buffer queue and the third buffer queue are empty, finishing the scanning.
Further, the processor 12 implements the following steps when executing the file scanning program stored in the memory 11: a pause step: when the number of the directories in the second cache queue reaches a second preset value, recording the number of the currently scanned file of the first part, the number of the currently scanned file of the second part and the current scanning depth;
then sequentially taking out each directory from the current second cache queue according to the priority of the directory and recording the directory as the current directory, and then executing a dividing step and a scanning step; and continuing to scan the rest part in the first part corresponding to the current scanning depth according to the currently scanned file number of the first part and the current scanning depth until the directory in the current second cache queue is empty, and continuing to scan the rest part in the second part corresponding to the current scanning depth according to the currently scanned file number of the second part and the current scanning depth.
Further, the processor 12 implements the following steps when executing the file scanning program stored in the memory 11: a display step: and displaying the classified files to a user through an interface according to the file types.
Further, the displaying step further comprises: and updating the number of the files of each file type in the interface after receiving the files in the second cache queue and classifying the files each time.
Further, the scanning step further comprises: and acquiring a first thread and a second thread from the thread pool, scanning the files and the directories of the first part in a forward order through the first thread, and scanning the files and the directories of the second part in a reverse order through the second thread.
Further, the number of all files and directories in the first part is half of that of all files and directories under the current directory.
EXAMPLE III
Preferably, the invention further provides an android device terminal provided with the android system. The android device terminal is connected with the mobile storage device through the USB interface, and is used for scanning and displaying files of the mobile storage device by executing the steps of the file scanning method of the mobile storage device provided by the embodiment when the mobile storage device is detected.
Preferably, the android device terminal includes a mobile device terminal with an android system, such as a mobile phone, a tablet, and other device terminals with an android system.
Example four
Preferably, the present invention further provides a storage medium, which is a computer-readable storage medium, on which a file scanning program is stored, the file scanning program being a computer program, and the file scanning program, when executed by a processor, implementing the steps of:
an identification step: when the device terminal detects and identifies the access of the mobile storage device, acquiring a root directory of the mobile storage device and the total number of files and directories under the root directory; meanwhile, setting the scanning depth to be 0, and recording the root directory of the mobile storage device as a current directory;
dividing: dividing all files and directories under the current directory into a first part and a second part according to a preset rule;
a scanning step: scanning the depth +1, and respectively scanning the files and the directories in the first part in a positive sequence and scanning the files and the directories in the second part in a reverse sequence; the positive sequence is the positive arrangement sequence of all files and directories under the current directory, and the reverse sequence is opposite to the positive sequence;
a first storage step: storing the scanned files in a first cache queue and storing the scanned directories in a second cache queue;
a classification step: when the number of the files in the first cache queue reaches a first preset value, all the files in the first cache queue are sent to a database of the equipment terminal, and all the files are classified according to file types;
and (3) circulating step: after the first part and the second part are scanned, sequentially taking out each directory from the second cache queue according to the priority of the directory and recording the directory as a current directory, and then executing a dividing step and a scanning step; until the directory in the second buffer queue is empty.
Further, the scanning step further comprises: judging whether the scanning depth is greater than a preset depth, if not, executing a first storage step; if yes, executing a second storage step;
the second storing step: and storing the scanned file in a first cache queue and storing the scanned directory in a third cache queue.
Further, when the directory in the second cache queue is empty and the directory of the third cache queue is not empty, clearing the scanning depth, then sequentially taking out each directory from the third cache queue according to the priority of the directory and recording the directory as the current directory, and executing the dividing step and the scanning step; until the directory in the third cache queue is empty; at this time, when the directories in the second cache queue are not empty, sequentially taking out one directory from the second cache queue according to the priority of the directory to be recorded as a current directory, and executing a dividing step and a scanning step until the directories in the second cache queue are empty;
and when the directories in the second buffer queue and the third buffer queue are empty, finishing the scanning.
Further, the file scanning program, when executed by the processor, implements the steps of: a pause step: when the number of the directories in the second cache queue reaches a second preset value, recording the number of the currently scanned file of the first part, the number of the currently scanned file of the second part and the current scanning depth;
then sequentially taking out each directory from the current second cache queue according to the priority of the directory and recording the directory as the current directory, and then executing a dividing step and a scanning step; and continuing to scan the rest part in the first part corresponding to the current scanning depth according to the currently scanned file number of the first part and the current scanning depth until the directory in the current second cache queue is empty, and continuing to scan the rest part in the second part corresponding to the current scanning depth according to the currently scanned file number of the second part and the current scanning depth.
Further, the file scanning program, when executed by the processor, implements the steps of: a display step: and displaying the classified files to a user through an interface according to the file types.
Further, the displaying step further comprises: and updating the number of the files of each file type in the interface after receiving the files in the second cache queue and classifying the files each time.
Further, the scanning step further comprises: and acquiring a first thread and a second thread from the thread pool, scanning the files and the directories of the first part in a forward order through the first thread, and scanning the files and the directories of the second part in a reverse order through the second thread.
Further, the number of all files and directories in the first part is half of that of all files and directories under the current directory.
The above embodiments are only preferred embodiments of the present invention, and the protection scope of the present invention is not limited thereby, and any insubstantial changes and substitutions made by those skilled in the art based on the present invention are within the protection scope of the present invention.

Claims (10)

1. A file scanning method of a mobile storage device is applied to a device terminal provided with an android system, and the device terminal is connected with the mobile storage device; the method is characterized by comprising the following steps:
an identification step: when the device terminal detects and identifies the access of the mobile storage device, acquiring a root directory of the mobile storage device and the total number of files and directories under the root directory; meanwhile, setting the scanning depth to be 0, and recording the root directory of the mobile storage device as a current directory;
dividing: dividing all files and directories under the current directory into a first part and a second part according to a preset rule;
a scanning step: scanning the depth +1, and respectively scanning the files and the directories in the first part in a positive sequence and scanning the files and the directories in the second part in a reverse sequence; the positive sequence is the positive arrangement sequence of all files and directories under the current directory, and the reverse sequence is opposite to the positive sequence;
a first storage step: storing the scanned files in a first cache queue and storing the scanned directories in a second cache queue;
a classification step: when the number of the files in the first cache queue reaches a first preset value, all the files in the first cache queue are sent to a database of the equipment terminal, and all the files are classified according to file types;
and (3) circulating step: after the first part and the second part are scanned, sequentially taking out each directory from the second cache queue according to the priority of the directory and recording the directory as a current directory, and then executing a dividing step and a scanning step; until the directory in the second buffer queue is empty.
2. The file scanning method of claim 1, wherein the scanning step further comprises: judging whether the scanning depth is greater than a preset depth, if not, executing a first storage step; if yes, executing a second storage step;
the second storing step: and storing the scanned file in a first cache queue and storing the scanned directory in a third cache queue.
3. The file scanning method of the mobile storage device according to claim 2, wherein when the directory in the second buffer queue is empty and the directory in the third buffer queue is not empty, the scanning depth is cleared, then each directory is sequentially taken out from the third buffer queue according to the priority of the directory and recorded as the current directory, and the dividing step and the scanning step are executed; until the directory in the third cache queue is empty; at this time, when the directories in the second cache queue are not empty, sequentially taking out one directory from the second cache queue according to the priority of the directory to be recorded as a current directory, and executing a dividing step and a scanning step until the directories in the second cache queue are empty;
and when the directories in the second buffer queue and the third buffer queue are empty, finishing the scanning.
4. The file scanning method of claim 1, further comprising the step of pausing: when the number of the directories in the second cache queue reaches a second preset value, recording the number of the currently scanned file of the first part, the number of the currently scanned file of the second part and the current scanning depth;
then sequentially taking out each directory from the current second cache queue according to the priority of the directory and recording the directory as the current directory, and then executing a dividing step and a scanning step; and continuing to scan the rest part in the first part corresponding to the current scanning depth according to the currently scanned file number of the first part and the current scanning depth until the directory in the current second cache queue is empty, and continuing to scan the rest part in the second part corresponding to the current scanning depth according to the currently scanned file number of the second part and the current scanning depth.
5. The file scanning method of the mobile storage device according to claim 1, further comprising: a display step: and displaying the classified files to a user through an interface according to the file types.
6. The file scanning method of claim 5, wherein the displaying step further comprises: and updating the number of the files of each file type in the interface after receiving the files in the second cache queue and classifying the files each time.
7. The file scanning method of claim 1, wherein the scanning step further comprises: and acquiring a first thread and a second thread from the thread pool, scanning the files and the directories of the first part in a forward order through the first thread, and scanning the files and the directories of the second part in a reverse order through the second thread.
8. The method of claim 1, wherein the number of all files and directories in the first portion is half of all files and directories under the current directory.
9. A storage medium which is a computer-readable storage medium having a file scanning program stored thereon, the file scanning program being a computer program, characterized in that: the file scanning program when executed by a processor implements the steps of a file scanning method of a mobile storage device as claimed in any one of claims 1-8.
10. An android device terminal, which is provided with a USB interface, is characterized in that the android device terminal is connected with a mobile storage device through the USB interface, and is configured to, when the mobile storage device is detected, perform the file scanning method of the mobile storage device according to any one of claims 1 to 8 to scan and display files in the mobile storage device.
CN202011197119.4A 2020-10-30 2020-10-30 File scanning method of mobile storage device, storage medium and device terminal Active CN112306959B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011197119.4A CN112306959B (en) 2020-10-30 2020-10-30 File scanning method of mobile storage device, storage medium and device terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011197119.4A CN112306959B (en) 2020-10-30 2020-10-30 File scanning method of mobile storage device, storage medium and device terminal

Publications (2)

Publication Number Publication Date
CN112306959A true CN112306959A (en) 2021-02-02
CN112306959B CN112306959B (en) 2023-10-17

Family

ID=74333241

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011197119.4A Active CN112306959B (en) 2020-10-30 2020-10-30 File scanning method of mobile storage device, storage medium and device terminal

Country Status (1)

Country Link
CN (1) CN112306959B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114860656A (en) * 2022-04-12 2022-08-05 深圳市绿联科技股份有限公司 File scanning method and device, electronic equipment and storage medium
CN117519839A (en) * 2024-01-05 2024-02-06 恒生电子股份有限公司 Data loading method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101656688A (en) * 2008-08-21 2010-02-24 华为技术有限公司 Method, system and device for displaying instant messages
CN107729476A (en) * 2017-10-16 2018-02-23 昆仑智汇数据科技(北京)有限公司 A kind of machine data on-line processing method and system
CN109951731A (en) * 2017-12-21 2019-06-28 深圳Tcl数字技术有限公司 Solve method, system and the storage medium of External memory equipment multiple scanning
CN111769933A (en) * 2020-06-29 2020-10-13 北京天融信网络安全技术有限公司 Method and device for monitoring file change, electronic equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101656688A (en) * 2008-08-21 2010-02-24 华为技术有限公司 Method, system and device for displaying instant messages
CN107729476A (en) * 2017-10-16 2018-02-23 昆仑智汇数据科技(北京)有限公司 A kind of machine data on-line processing method and system
CN109951731A (en) * 2017-12-21 2019-06-28 深圳Tcl数字技术有限公司 Solve method, system and the storage medium of External memory equipment multiple scanning
CN111769933A (en) * 2020-06-29 2020-10-13 北京天融信网络安全技术有限公司 Method and device for monitoring file change, electronic equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114860656A (en) * 2022-04-12 2022-08-05 深圳市绿联科技股份有限公司 File scanning method and device, electronic equipment and storage medium
CN117519839A (en) * 2024-01-05 2024-02-06 恒生电子股份有限公司 Data loading method and device
CN117519839B (en) * 2024-01-05 2024-04-16 恒生电子股份有限公司 Data loading method and device

Also Published As

Publication number Publication date
CN112306959B (en) 2023-10-17

Similar Documents

Publication Publication Date Title
US9619275B2 (en) Data processing method, apparatus and mobile terminal
US11429563B2 (en) Prioritizing thumbnail previews based on message content
US20180173450A1 (en) Method and Device for File Name Identification and File Cleaning
CN112306959B (en) File scanning method of mobile storage device, storage medium and device terminal
CN110989937B (en) Data storage method, device and equipment and computer readable storage medium
CN109299205B (en) Method and device for warehousing spatial data used by planning industry
CN102799613A (en) Showing method and device for recently-used file
CN114416667A (en) Method and device for rapidly sharing network disk file, network disk and storage medium
CN113434943B (en) BIM standard code processing method and device, electronic equipment and readable storage medium
CN110688353A (en) File management method, device and computer readable medium
CN109472540B (en) Service processing method and device
CN104079623A (en) Method and system for controlling multilevel cloud storage synchrony
CN107704341A (en) File access pattern method, apparatus and electronic equipment
CN112969198A (en) Data transmission method, terminal and storage medium
CN111460629A (en) Graphic data checking method and device, electronic equipment and computer storage medium
CN108664486B (en) Webpage texture memory management method and device
CN111143293B (en) Metadata acquisition method, device, equipment and computer readable storage medium
CN114186976A (en) Workflow transfer method and device, computer equipment and storage medium
CN110069493B (en) Data processing method, device, computer equipment and storage medium
CN113592448A (en) Internet product archive management method, system, electronic equipment and storage medium
CN113806107B (en) Object copying method, device, equipment and storage medium
JP2015075919A (en) File management device and system, and program
CN111597773B (en) Compression processing method, compression processing device, computer storage medium and terminal
CN112783840B (en) Method and device for storing document, electronic equipment and storage medium
CN113885963B (en) Secondary development file execution method, device and storage medium

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: Room 238, room 406, 1 Yichuang street, Huangpu District, Guangzhou, Guangdong 510700

Applicant after: Guangzhou langguo Electronic Technology Co.,Ltd.

Address before: 510700 15 / F, unit 1, building 2, Yunsheng Science Park, No. 11, Zhongmian Road, Huangpu District, Guangzhou City, Guangdong Province

Applicant before: GUANGZHOU LANGO ELECTRONIC SCIENCE & TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant