CN102402543B - A kind of method of search file and device - Google Patents

A kind of method of search file and device Download PDF

Info

Publication number
CN102402543B
CN102402543B CN201010282721.8A CN201010282721A CN102402543B CN 102402543 B CN102402543 B CN 102402543B CN 201010282721 A CN201010282721 A CN 201010282721A CN 102402543 B CN102402543 B CN 102402543B
Authority
CN
China
Prior art keywords
file
search
searched
information
last
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.)
Active
Application number
CN201010282721.8A
Other languages
Chinese (zh)
Other versions
CN102402543A (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.)
Wuxi Zhonggan Microelectronics Co Ltd
Original Assignee
Wuxi Zhonggan Microelectronics 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 Wuxi Zhonggan Microelectronics Co Ltd filed Critical Wuxi Zhonggan Microelectronics Co Ltd
Priority to CN201010282721.8A priority Critical patent/CN102402543B/en
Publication of CN102402543A publication Critical patent/CN102402543A/en
Application granted granted Critical
Publication of CN102402543B publication Critical patent/CN102402543B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a kind of method and device of search file, in order to improve the speed of file search.The method comprises: the information obtaining last file searched last time, according to the information of last file described, determine the start file under current search path, from described start file, search for next file, and upgrade the number of the file searched, number after renewal and setting value are compared, when described number reaches setting value, return the information of all files searched, and the number of the file searched.

Description

A kind of method of search file and device
Technical field
The present invention relates to field of computer technology, particularly a kind of method of search file and device.
Background technology
At mobile phone, in the multimedia processing system of the handheld devices such as PMP, some upper layer application interfaces need dir, this just needs in the storage medium of these handheld devices, carry out the search of disk file, along with the popularization and application of the storage medium of the dynamic plugs such as usb and sdcard, the file on disk is all likely changed at any time, and this just needs disposal system to search for disk file at any time.
Another one aspect, along with the capacity of storage medium is increasing, the number of files that storage medium can be preserved also gets more and more, and the speed of search file is directly connected to reaction time during upper layer application interface display.At present, the interface of the search file that the file system in general multimedia processing system provides has two, be respectively: findfirst and findnext, the feature of these two interfaces is exactly to search a file or file at every turn, in search procedure, upper layer application in multimedia processing system needs to call the object that these two interfaces realize searching for whole disk All Files frequently, such as: disk has 1000 files, so just need to call 1000 findfirst and findnext in search procedure.Often search for once, upper layer application in multimedia processing system just with file system mutual once, obtain the information of a file, like this, when disk file is many, upper layer application in multimedia processing system is carried out repeatedly mutual with regard to needs and file system, causes a large amount of time resource consumption, have impact on the speed of search.
Summary of the invention
The embodiment of the present invention provides a kind of method and device of search file, in order to improve the speed of file search.
The embodiment of the present invention provides a kind of method of search file, comprising:
Obtain the information of last file searched last time;
According to the information of last file described, determine the start file under current search path;
From described start file, search for next file, and upgrade the number of the file searched, number after renewal and setting value are compared, when described number reaches setting value, return the information of all files searched, and the number of the file searched.
The embodiment of the present invention provides a kind of device of file search, comprising:
Acquiring unit, for obtaining the information of last file searched last time;
Determining unit, for the information according to last file described, determines the start file under current search path;
Search unit, for from described start file, searches for next file, and upgrade the number of the file searched, the number after renewal and setting value are compared, when described number reaches setting value, return the information of all files searched, and the number of the file searched.
In the embodiment of the present invention, obtain the information of last file searched last time, according to the information of last file, determine the start file under current search path, from described start file, search for next file, and upgrade the number of the file searched, number after renewal and setting value are compared, when described number reaches setting value, return the information of all files searched, and the number of the file searched, like this, after often searching a file, upper layer application in multimedia processing system is not carry out with file system alternately at once, obtain the information of this file, just when the number of the file searched is equal with setting value, upper layer application ability in medium processing system is mutual once with file system, obtain all information searching file.Thus, while realizing multiple file search, decrease the interaction times of upper layer application in multimedia processing system and file system, save the time of search, improve the speed of file search.
Accompanying drawing explanation
Fig. 1 is the process flow diagram of search file in the embodiment of the present invention;
Fig. 2 is the process flow diagram of search file in the specific embodiment of the invention;
Fig. 3 is the structural drawing of search file device in the embodiment of the present invention.
Embodiment
In the embodiment of the present invention, after the path setting search file in upper layer application in multimedia processing system and the number needing search file, by the application programming interfaces (API that embodiment of the present invention file system provides, ApplicationProgrammingInterface) once search for, just can obtain the information of multiple file, decrease mobile phone, upper layer application in the multimedia processing system of the handheld devices such as PMP and the interaction times of file system, save the time of search, improve the speed of file search.
In the embodiment of the present invention, broad sense is compared in the definition of file, includes: file, file, and one or more in file directory.
In the embodiment of the present invention, set the path of search file in upper layer application and needed the number of search file, namely the API in the embodiment of the present invention has determined current search path, and determine and need the number of search file to be setting value, so, the process of this API search file, see Fig. 1, specifically comprises:
Step 101: the information obtaining last file searched last time.
Here, the information of file comprises: filename, file attribute, file size, and the path at file place.
When first time starts search file, last file not having searched last time, then the fileinfo obtained is empty information.
When be not first time start search file time, after searching at every turn, all by the information feed back of All Files that searches to the upper layer application in multimedia processing system, namely upper layer application all obtains the information of all files searched from file system, and the number of the file searched, therefore, the upper layer application in multimedia processing system saves the information of last file searched last time.
Here, from the information of file that the last time that upper layer application is preserved searches, obtain the information of last file searched last time, specifically comprise: the information copying last file that (COPY) last time searches from upper layer application, and revise file system inner parameter.
Step 102: according to the information of last file, determines the start file under current search path.
The path at file place is included in the information of last file, this path is mated with current search path, when both are consistent, determine that start file is last file obtained, when both are inconsistent, are shown to be and search under current search path for the first time, therefore, start file under current search path is zero, and namely need start anew search under current search path.
Step 103: from start file, searches for next file, and upgrades the number of the file searched.
Here, before searching for, the number of this file searched is zero, after often searching a file, just the number of the file searched is added 1, namely searches a file, just upgrades the number of the file once searched.
The procedure file internal system of search still needs to call these two interfaces of findfirst and findnext.Often search a file, temporarily do not return the information of this file to the upper layer application in multimedia processing system, just upgrade the number of the file searched.
Step 104: judge that whether the number of file searched after upgrading is equal with setting value, if so, perform step 105, otherwise, using the file that searches as start file, return step 103.
Before this search, set the path of search file in upper layer application and needed the number of search file, namely the API in the embodiment of the present invention has determined needs the number of search file to be setting value, here, the number of the file searched and setting value are compared, if the number of the file searched is equal with setting value, then can determine that the target that this is searched for is reached, perform step 105, otherwise, also need to proceed search, using the file that searches as start file, return step 103, by current this file searched out as start file, return step 103.
Step 105: the information returning all files searched, and the number of the file searched, this search procedure is complete.
The number of the file searched is equal with setting value, the number of the file of search is needed to reach, therefore, obtain the information of all files searched, and the number of the file searched, and by the information of all files searched, and the number of the file searched returns to upper layer application.
Like this, upper layer application can preserve the information of last file that this searches, like this, so that file search next time.
In the embodiment of the present invention, after often searching a file, file system be not at once by the information feed back of this file to the upper layer application in multimedia processing system, just when the number of the file searched is equal with setting value, the upper layer application ability of medium processing system is mutual once with file system, obtains all information searching file.Visible, in the process of search, although file system inside also repeatedly have invoked these two interfaces of findfirst and findnext, the upper layer application of medium processing system and file system mutual for once, namely the API that embodiment of the present invention file system provides only is called, thus, while realizing multiple file search, decrease the upper layer application of multimedia processing system and the interaction times of file system, save the time of search, improve the speed of file search.
In the embodiment of the present invention, need the number of the file of search, namely setting value is generally determined according to the internal memory of multimedia processing system, if setting value is too large, the information of the file searched that upper layer application obtains will occupy too many memory headroom, is unfavorable for the operation of multimedia processing system, if setting value is too little, the information of the file searched then once obtained very little, can not significantly improve the speed of file search.
In the search procedure of above-described embodiment, if when the number of the All Files under current search path can not reach setting value, the information less than all files searched may be obtained, and the number of the file searched, therefore, in the embodiment of the present invention, before above-mentioned steps 104, the file that judges to search also is needed to be whether last file under current search path, namely whether file is also had under judging current search path, if the file searched is last file under current search path, so, direct execution step 105, return the information of all files searched, and the number of the file searched, do not need to carry out follow-up step 104 again.
Now, return the information of all files searched, and after the number of the file searched, because the number of the file searched also may not reach setting value, then upper layer application can determine whether still proceed search according to practical application, search is still proceeded if determine, so, the number of the file searched obtained and setting value compare by upper layer application, if be less than setting value, then specify next searching route, like this, the API that embodiment of the present invention file system provides can according to this instruction, be next searching route by current search routing update, proceed search, until the number of the file searched reaches setting value.Certainly, no longer carry out having searched for if determine, this searches for end.Or the number of the file searched reaches setting value, then also do not need to carry out having searched for, this searches for end.
Before above-described embodiment is searched for, multimedia processing system may carry out other upper level applications, the search disk that so disk of work at present is not necessarily corresponding with current search path, when searching for disk and not mating with work at present disk, work at present disk must be switched to search disk.
Below in conjunction with Figure of description, the embodiment of the present invention is described in further detail.
In the present embodiment, determine current search path, and determined and need the number of search file to be setting value.See Fig. 2, the process of search file comprises:
Step 201: determine the search disk that current search path is corresponding.
If in the present embodiment, multimedia processing system supports the file system of two disks, and A is disk 1, B is disk 2, so, if current search path is (" A:/abc/123 "), then determines that corresponding search disk is disk 1.
Step 202: judge that whether search disk is consistent with work at present disk, if unanimously, perform step 204, otherwise perform step 203.
If in the present embodiment, work at present disk is disk 1, so consistent with search disk, directly performs step 204, if work at present disk is disk 2, so inconsistent with search disk, performs step 203.
Step 203: work at present disk is switched to search disk, and proceed to execution step 204.
Step 204: the information obtaining last file searched last time.
Step 205: according to the information of last file that the last time of preserving searches, determine the start file under current search path.
Step 206: from start file, searches for next file, and upgrades the number of the file searched.
Step 207: judge that whether the file that searches is last file under current search path, if so, perform step 209, otherwise, perform step 208.
Step 208: judge that whether the number of file searched is equal with setting value, if so, perform step 209, otherwise, using the file that searches as start file, return step 206.
Step 209: by the information of all files searched, and the number of the file searched returns to upper layer application, and this search procedure is complete.
If in the present embodiment, setting number is 10,8 files are only searched under current search path, so, when step 209 returns the information of all files searched, and after the number of the file searched, can also by the instruction according to upper layer application, be next searching route by current search routing update, then continue search, until search 10 files.
In the various embodiments described above, with mobile phone, the multimedia processing system of the handheld devices such as PMP is that example is described, but the present invention is not limited thereto, and the disposal system of other intelligent terminal also can be applied.
According to the method for above-mentioned search file, a kind of device of search file can be built, see Fig. 3, comprise: acquiring unit 100, determining unit 200 and search unit 300.Wherein,
Acquiring unit 100, for obtaining the information of last file searched last time.
Determining unit 200, for the information according to last file described, determines the start file under current search path.
Search unit 300, for from described start file, search for next file, and upgrade the number of the file searched, number after renewal and setting value are compared, when described number reaches setting value, return the information of all files searched, and the number of the file searched.
This determining unit 200 comprises:
First matching unit, for mating the path at the file place in the information of last file described with described current search path.
Determine subelement, for when both are consistent, determine that start file is last file described, when both are inconsistent, determine that start file is zero.
Certainly, in the embodiment of the present invention, if when the number of the All Files under current search path can not reach setting value, the information less than all files searched may be obtained, and the number of the file searched, therefore, in the embodiment of the present invention, search unit 300, also for judging that whether the file that searches is last file under current search path, if so, the information of all files searched is obtained, and the number of the file searched.
Obtain the information of all files searched, and after the number of the file searched, because the number of the file searched also may not reach setting value, can be then next searching route by current search routing update, proceed search, until the number of the file searched reaches setting value.Therefore, search unit 300, also for being next searching route by described current search routing update.
This device is before searching for, multimedia processing system may carry out other upper level applications, the search disk that so disk of work at present is not necessarily corresponding with current search path, when searching for disk and not mating with work at present disk, work at present disk must be switched to search disk, therefore, this device also comprises:
Switch unit, if when not mating with work at present disk for the search disk corresponding with current search path, is switched to described search disk by described work at present disk.
The device of the search file in the embodiment of the present invention can be applied in multimedia processing system, corresponding to the API that file system provides.But the present invention is not limited thereto, also can apply with the disposal system of other intelligent terminal.
In the embodiment of the present invention, obtain the information of last file searched last time, according to the information of last file, determine the start file under current search path, from described start file, search for next file, and upgrade the number of the file searched, number after renewal and setting value are compared, when described number reaches setting value, return the information of all files searched, and the number of the file searched, when described number does not reach setting value, continue the next file of search, until the number of the file searched reaches described setting value, like this, after often searching a file, the upper layer application of multimedia processing system is not carry out with file system alternately at once, obtain the information of this file, just when the number of the file searched is equal with setting value, upper layer application ability in medium processing system is mutual once with file system, obtain all information searching file.Thus, while realizing multiple file search, decrease the interaction times of multimedia processing system and file system, save the time of search, improve the speed of file search.
Obviously, those skilled in the art can carry out various change and modification to the present invention and not depart from the spirit and scope of the present invention.Like this, if these amendments of the present invention and modification belong within the scope of the claims in the present invention and equivalent technologies thereof, then the present invention is also intended to comprise these change and modification.

Claims (10)

1. a method for search file, is characterized in that, comprising:
Obtain the information of last file searched last time;
According to the information of last file described, determine the start file under current search path;
From described start file, search for next file, and upgrade the number of the file searched, number after renewal and setting value are compared, when described number reaches setting value, return the information of all files searched, and the number of the file searched.
2. the method for claim 1, is characterized in that, describedly determines that the start file under current search path comprises:
The path at the file place in the information of last file described is mated with described current search path;
When both are consistent, determine that start file is last file described;
When both are inconsistent, determine that start file is zero.
3. the method for claim 1, is characterized in that, described by the number after upgrading and before setting value compares, and also comprises:
Judge that whether the file that searches is last file under current search path;
If so, the information of all files searched is obtained, and the number of the file searched;
Otherwise, perform the number after upgrading and the step that compares of setting value.
4. method as claimed in claim 3, is characterized in that, described in return the information of all files searched, and after the number of the file searched, also to comprise:
Be next searching route by described current search routing update.
5. the either method as described in claim 1-4, is characterized in that, before the information of last file that described acquisition searched last time, also comprises:
The search disk corresponding with current search path is mated with work at present disk;
When both are inconsistent, described work at present disk is switched to described search disk.
6. a device for search file, is characterized in that, comprising:
Acquiring unit, for obtaining the information of last file searched last time;
Determining unit, for the information according to last file described, determines the start file under current search path;
Search unit, for from described start file, searches for next file, and upgrade the number of the file searched, the number after renewal and setting value are compared, when described number reaches setting value, return the information of all files searched, and the number of the file searched.
7. device as claimed in claim 6, it is characterized in that, described determining unit comprises:
First matching unit, for mating the path at the file place in the information of last file described with described current search path;
Determine subelement, for when both are consistent, determine that start file is last file described, when both are inconsistent, determine that start file is zero.
8. device as claimed in claim 6, is characterized in that,
Described search unit, also for judging that whether the file that searches is last file under current search path, if so, obtains the information of all files searched, and the number of the file searched.
9. device as claimed in claim 8, is characterized in that,
Described search unit, also for being next searching route by described current search routing update.
10. the arbitrary device as described in claim 6-9, is characterized in that, also comprise:
Switch unit, if when not mating with work at present disk for the search disk corresponding with current search path, is switched to described search disk by described work at present disk.
CN201010282721.8A 2010-09-14 2010-09-14 A kind of method of search file and device Active CN102402543B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201010282721.8A CN102402543B (en) 2010-09-14 2010-09-14 A kind of method of search file and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201010282721.8A CN102402543B (en) 2010-09-14 2010-09-14 A kind of method of search file and device

Publications (2)

Publication Number Publication Date
CN102402543A CN102402543A (en) 2012-04-04
CN102402543B true CN102402543B (en) 2016-02-03

Family

ID=45884757

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201010282721.8A Active CN102402543B (en) 2010-09-14 2010-09-14 A kind of method of search file and device

Country Status (1)

Country Link
CN (1) CN102402543B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0798654A1 (en) * 1996-03-29 1997-10-01 Sun Microsystems, Inc. Converting handle-based find first/find next/find close to non-handle based find first/find next
EP0805392A1 (en) * 1996-05-01 1997-11-05 Sun Microsystems, Inc. Smart, least-recently-used method for reusing directory search handles
CN1776686A (en) * 2005-12-16 2006-05-24 北京中星微电子有限公司 Position-based interface access method and device for FAT file system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070027929A1 (en) * 2005-08-01 2007-02-01 Whelan Gary J System, method, and/or computer program product for a file system interface
US20070124295A1 (en) * 2005-11-29 2007-05-31 Forman Ira R Systems, methods, and media for searching documents based on text characteristics

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0798654A1 (en) * 1996-03-29 1997-10-01 Sun Microsystems, Inc. Converting handle-based find first/find next/find close to non-handle based find first/find next
EP0805392A1 (en) * 1996-05-01 1997-11-05 Sun Microsystems, Inc. Smart, least-recently-used method for reusing directory search handles
CN1776686A (en) * 2005-12-16 2006-05-24 北京中星微电子有限公司 Position-based interface access method and device for FAT file system

Also Published As

Publication number Publication date
CN102402543A (en) 2012-04-04

Similar Documents

Publication Publication Date Title
US11068441B2 (en) Caseless file lookup in a distributed file system
US9292217B2 (en) Logical volume space sharing
US11086638B2 (en) Method and apparatus for loading application
CN105718287B (en) A kind of program streaming execution method of intelligent terminal
CN106708565B (en) Method and device for clearing useless picture resources in APK
CN105740425A (en) File storage method and apparatus
CN102214109B (en) Method and device for loading plug-ins
CN107247722B (en) File scanning method and device and intelligent terminal
CN104850301A (en) Method and system for classifying application icons on system desktop
CN105045637A (en) Application start method and terminal
CN104714835A (en) Data access processing method and device
CN105446772A (en) System upgrading method and apparatus
CN105955770A (en) Application program uninstalling method and terminal
WO2015027902A1 (en) Method, computing device, and computer program product for storing file index
CN107632872B (en) Desktop layout processing method, user data processing method and device and computer storage medium
CN102508892A (en) System and method for quickly previewing pictures
CN104268012A (en) Picture data processing method and device
RU2616164C2 (en) Methods and device for browser engine work
CN105138604A (en) Terminal data processing method and apparatus
CN102004633B (en) Method and device for processing control property
CN102402543B (en) A kind of method of search file and device
CN101183366A (en) Photograph document handling method and system
US20140280263A1 (en) Electronic device with a funiction of applying applications of different operating systems and method thereof
CN113721936B (en) Application management method, intelligent terminal, device and storage medium
CN106407322A (en) Quick file searching method based on Android system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 214028 national integrated circuit design (21-1), Changjiang Road, New District, Jiangsu, Wuxi, China, China (610)

Applicant after: WUXI ZHONGGAN MICROELECTRONIC CO., LTD.

Address before: 214028 national integrated circuit design (21-1), Changjiang Road, New District, Jiangsu, Wuxi, China, China (610)

Applicant before: Wuxi Vimicro Co., Ltd.

COR Change of bibliographic data
C14 Grant of patent or utility model
GR01 Patent grant