CN102289451A - Find the file or folder method and apparatus - Google Patents

Find the file or folder method and apparatus Download PDF

Info

Publication number
CN102289451A
CN102289451A CN2011101639540A CN201110163954A CN102289451A CN 102289451 A CN102289451 A CN 102289451A CN 2011101639540 A CN2011101639540 A CN 2011101639540A CN 201110163954 A CN201110163954 A CN 201110163954A CN 102289451 A CN102289451 A CN 102289451A
Authority
CN
China
Prior art keywords
file
folder
files
attributes
address
Prior art date
Application number
CN2011101639540A
Other languages
Chinese (zh)
Inventor
唐智
Original Assignee
奇智软件(北京)有限公司
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 奇智软件(北京)有限公司 filed Critical 奇智软件(北京)有限公司
Priority to CN2011101639540A priority Critical patent/CN102289451A/en
Publication of CN102289451A publication Critical patent/CN102289451A/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; 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

Abstract

本发明提供了一种文件或文件夹查找方法,包括以下步骤:读取主引导记录区的内容,获取硬盘分区格式;根据硬盘分区格式获取硬盘中所有文件或文件夹属性的记录地址,并根据所述文件或文件夹属性的记录地址将所有文件或文件夹属性读入内存;在读入内存的所有文件或文件夹属性中遍历查找全部或部分文件或文件夹。 The present invention provides a folder or file searching method, comprising the steps of: reading the contents of the master boot record area, the hard disk partition obtain format; recording address obtaining all of the hard disk a file or folder attribute format The hard disk partition, and in accordance with the attributes of a file or folder address records all the files or folders into memory attributes; traverse all or part of the file to find all files or a file in memory a folder or folder attribute. 本发明还提供了一种实现前述方法的文件或文件夹查找装置。 The present invention also provides a file or folder for implementing the foregoing method to find means. 本发明的文件或文件夹查找方法和装置,能够实现快速的文件或文件夹的查找和减少对计算机资源的占用。 File or folder of the present invention to find a method and apparatus, it is possible to find and reduce the occupancy of computer resources fast file or folder.

Description

文件或文件夹查找方法和装置 Find the file or folder method and apparatus

技术领域 FIELD

[0001] 本发明涉及计算机存储数据查找技术领域,特别是涉及一种文件或文件夹查找方法和装置。 [0001] The present invention relates to a computer storage data search technologies, and more particularly to a file or folder to find a method and apparatus.

背景技术 Background technique

[0002] 硬盘是现在计算机上最常用的存储设备,计算机中文件或文件夹都以文件记录的形式存储在硬盘里。 [0002] on the computer hard disk is now the most commonly used storage devices, computer files or folders are stored as files recorded in the hard disk. 一个硬盘可以区分为多个分区。 A hard disk can be divided into multiple partitions. 分区从实质上说就是对硬盘的一种格式化。 Zoning in essence is a kind of format the hard disk. 当我们创建分区时,就已经设置好了硬盘的各项物理参数,指定了硬盘主引导记录(即Master Boot Record,一般简称为主引导记录区)和引导记录备份的存放位置。 When we create a partition, it has already set up the physical parameters of the hard disk, specify the hard disk master boot record (ie, Master Boot Record, generally referred to as the master boot record area) storage location and boot record backup.

[0003] 通常Windows下从硬盘中查找一个指定的或者全部的文件或文件夹是调用FindFirstFile 禾口FindNextFile 这两个API (Application Programming Interface,应用程序编程接口)来实现的。 [0003] or search for a specific file or all files in the usual Windows folder from your hard drive by calling FindFirstFile Hekou FindNextFile both API (Application Programming Interface, Application Programming Interface) to achieve. 实际运用中,因为硬盘中的文件或文件夹数量较大,例如,十万或者更多,调用这两个API会发生数以万次的I/Oanput/Output,输入/输出)操作,因此查找速度上会较慢。 Practice, because the hard disk in a file or folder larger number, for example, one hundred thousand or more, the number of API calls to two million times the I / Oanput / Output, Input / Output) operations will occur, so finding speed will be slower.

[0004] 在Windows XP以下加入了索引技术,对于重复操作的操作能实现快速的查找,但是在第一次搜索时也还是比较慢的。 [0004] In the following Windows XP joined the indexing techniques, for repeated operations to achieve a quick look, but when the first search is still relatively slow. 另外,因为频繁的使用1/0操作,还可能造成对计算机资源的占用,从而使计算机的响应变得缓慢。 In addition, because of frequent use 1/0 operation, and it may cause the occupation of computer resources, so that the computer becomes slow response.

发明内容 SUMMARY

[0005] 本发明所要解决的技术问题是提供一种文件或文件夹查找方法和装置,能够实现快速的文件或文件夹的查找和减少对计算机资源的占用。 [0005] The present invention solves the technical problem is to provide a file or folder to find a method and apparatus can be realized quickly find a file or folder and reduce the occupancy of computer resources.

[0006] 为了解决上述问题,本发明公开了一种文件或文件夹查找方法,包括以下步骤: [0006] In order to solve the above problems, the present invention discloses a folder or file searching method, comprising the steps of:

[0007] 读取主引导记录区的内容,获取硬盘分区格式; [0007] The read contents of the master boot record area, obtaining hard disk partition scheme;

[0008] 根据硬盘分区格式获取硬盘中所有文件或文件夹属性的记录地址,并根据所述文件或文件夹属性的记录地址将所有文件或文件夹属性读入内存; [0008] The format of the hard disk partition the hard disk recording address obtaining all of the files or folders according to attributes, and recording the address of the folder or file attributes of all the files or folders attributes into memory;

[0009] 在读入内存的所有文件或文件夹属性中遍历查找全部或部分文件或文件夹。 [0009] All or part of the file traversal to find all files or folders into memory properties or folder.

[0010] 进一步地,所述根据硬盘分区格式获取所有文件或文件夹属性的记录地址,并根据所述文件或文件夹属性的记录地址将所有文件或文件夹属性读入内存包括: [0010] Further, the recording address obtaining all of the files or the folder properties The hard disk partition format, and recording the address of the folder or file attributes of all the files or folders into memory attributes comprises:

[0011] 若硬盘分区格式为FAT12,FAT16或FAT32,从文件分配表获取所有文件或文件夹属性的记录地址,并根据文件或文件夹属性的记录地址将文件分配表中的所有文件或文件夹属性读入内存;和/或 [0011] If the hard disk partition format of FAT12, FAT16, or FAT32, obtaining records the addresses of all the file or folder attribute from the file allocation table, and according to the file or folder attributes recording address all files or a file allocation table in a folder properties read into memory; and / or

[0012] 若硬盘分区格式为NTFS,从主文件表中获取所有文件或文件夹属性的记录地址, 并根据文件或文件夹属性的记录地址将主文件表中的所有文件或文件夹属性读入内存。 [0012] If the hard disk partition format to NTFS, obtaining records the addresses of all the file or folder attributes from the master file table, and recording address attribute of the document or folder for all files or master file table folder attribute read RAM.

[0013] 进一步地,所述从文件分配表获取所有文件或文件夹属性的记录地址,并根据文件或文件夹属性的记录地址将文件分配表中的所有文件或文件夹属性读入内存包括: [0013] Further, the recording address obtaining all of the files or the folder attributes from the file allocation table, and the recording address of a file or folder attribute files or all files in the folder the file allocation table attribute into memory comprises:

[0014] 读取BIOS参数块的内容,获取文件分配表的起始地址和大小;[0015] 确定文件分配表中所有文件或文件夹属性所在记录项的记录起止地址; [0014] The BIOS reads the contents of the parameter block, obtaining start address and size of the file allocation table; [0015] determine the file allocation table any file or folder attributes where the recording start and end address item;

[0016] 根据确定的所有文件或文件夹属性所在记录项的记录起止地址将文件分配表中所有文件或文件夹属性读入内存。 [0016] According to certain files or all files recorded starting and ending address where the recording folder attribute item files or all files in the folder attribute file allocation table read into memory.

[0017] 进一步地,所述从主文件表中获取所有文件或文件夹属性的记录地址,并根据文件或文件夹属性的记录地址将主文件表中的所有文件或文件夹属性读入内存包括: [0017] Further, the recording address obtaining all of the files or the folder attributes from the master file table, and recording address of a file or folder attributes of all the files or folders in the master file table attribute into memory comprising :

[0018] 读取BIOS参数块的内容,获取主文件表的起始地址和大小; [0018] The BIOS reads the contents of the parameter block, obtaining start address and size of the master file table;

[0019] 确定主文件表中所有文件或文件夹属性所在记录项的记录起止地址; [0019] The master file table is determined for all attributes file or folder where the recording start and end address item;

[0020] 根据确定的所有文件或文件夹属性所在记录项的记录起止地址将主文件表中所有文件或文件夹属性读入内存。 [0020] According to certain files or all files recorded clip attribute start and end addresses where the entries of all files or folders master file attribute table read into memory.

[0021] 进一步地,所述从主文件表中获取所有文件或文件夹属性的记录地址,并根据文件或文件夹属性的记录地址将主文件表中的所有文件或文件夹属性读入内存包括: [0021] Further, the recording address obtaining all of the files or the folder attributes from the master file table, and recording address of a file or folder attributes of all the files or folders in the master file table attribute into memory comprising :

[0022] 通过CreateFile打开元文件$MFT来获取整个主文件表的所有文件或文件夹属性所在记录项的记录地址,并根据所述文件或文件夹属性所在记录项的记录地址获取所述文件或文件夹属性。 [0022] files or all files open by $ MFT metafile CreateFile entire master file table to obtain the attribute of the folder where the recorded address recorded items, and recording address of an item according to the file or folder or file acquiring the property is located folder properties.

[0023] 进一步地,所述在内存中所有文件或文件夹属性中遍历查找包括: [0023] Further, in the memory of all the files or folders to find traversal attribute comprises:

[0024] 遍历每一个文件或文件夹属性,获取文件或文件夹的属性信息,以对文件或文件 [0024] through each folder or file attributes, acquires the attribute information of a file or folder, in a file or

夹进行管理。 Folder management.

[0025] 进一步地,所述在内存中所有文件或文件夹属性中遍历查找,包括: [0025] Further, in the memory of all the files or the folder properties of exhaustive searching, comprising:

[0026] 确定文件分配表或主文件表的起始地址; [0026] The start address of the file allocation table to determine or master file table;

[0027] 从起始地址开始,依次偏移文件或文件夹属性所在记录项所占用的字节数,直至遍历完成。 [0027] From the start address, successively offset in the file or folder attributes where the number of bytes occupied by items recorded until complete traversal.

[0028] 进一步地,所述在内存中所有数据属性中遍历查找包括: [0028] Further, the data in all the memory attributes of exhaustive searching comprises:

[0029] 确定主文件表中文件或文件夹属性在其所在记录项中的存储位置,在所述存储位置进行查找。 [0029] The master file table to determine the file or folder attributes, to find the location in which it is stored in the storage location of entries.

[0030] 进一步地,所述在读入内存的所有文件或文件夹属性中遍历查找全部或部分文件或文件夹包括: [0030] Further, the files or all files in a folder into memory properties of exhaustive searching all or part of a file or folder comprising:

[0031] 根据在查找时加入的文件或文件夹特征作为查找条件,在读入内存的所有文件或文件夹属性中遍历查找全部或部分文件或文件夹; [0031] The added when searching for a file or folder as a search condition wherein all of the file or folder read into memory properties of all or part of traversal to find files or folders;

[0032] 并将查找到的文件或文件夹展示。 [0032] and show clips to find the file or files.

[0033] 进一步地,所述查找条件包括以下一种或多种:文件名、文件夹名、创建日期、最后访问日期和大小。 [0033] Further, the search conditions include one or more of the following: file name, folder name, creation date, last access date and size.

[0034] 进一步地,所述指定文件或文件夹的查找包括以下一种或几种: [0034] Further, the search for the specified file or folder comprises one or more of the following:

[0035] 重复文件或文件夹查找、0字节文件或文件夹查找、指定文件或文件夹查找,以及垃圾文件查找。 [0035] find duplicate files or folders, 0 byte file or folder to find, to find the specified file or folder, and junk file search.

[0036] 进一步地,所述方法还包括删除所述查找到的文件或文件夹。 [0036] Preferably, the method further comprises deleting the found file or folder.

[0037] 进一步地,所述方法还包括: [0037] Preferably, the method further comprising:

[0038] 若出现新的硬盘分区格式,从服务器中获取文件或文件夹属性的记录地址。 [0038] If the new hard disk partition format appears, from the server to obtain a file or folder recorded address attributes.

[0039] 进一步地,所述硬盘中所有文件或文件夹属性包括以下一种或多种: [0039] Further, all of the hard disk a file or folder attribute comprises one or more of:

[0040] 名称、大小、创建时间、创建日期、最后访问日期、最后修改日期。 [0040] name, size, creation date, creation date, last access date, last modification date. [0041] 进一步地,所述方法还包括: [0041] Preferably, the method further comprising:

[0042] 根据硬盘分区格式获取硬盘中所有文件或文件夹的存放位置。 [0042] The hard disk storage position all the files or folders acquired in accordance with the format of the hard disk partition.

[0043] 进一步地,所述将所有文件或文件夹属性读入内存包括: [0043] Furthermore, all the files or the folder attributes into memory comprises:

[0044] 将所有文件或文件夹属性一次读入内存;或 [0044] All properties of a file or folder is read into memory; or

[0045] 将所有文件或文件夹属性分段读入内存。 [0045] All attributes file or folder read into memory segment.

[0046] 为了解决上述问题,本发明还公开了一种文件或文件夹查找装置,包括: [0046] In order to solve the above problems, the present invention also discloses a means to find a file or folder, comprising:

[0047] 主引导记录区内容读取模块,用于读取主引导记录区的内容,获取硬盘分区格式; [0047] The master boot record area content reading means for reading the contents of the master boot record area, obtaining hard disk partition scheme;

[0048] 记录获取模块,用于根据硬盘分区格式获取硬盘中所有文件或文件夹属性的记录地址,并根据所述文件或文件夹属性的记录地址将所有文件或文件夹属性读入内存; [0048] recording acquiring module, for acquiring all of the hard disk recording address or a file folder properties The hard disk partition format, and recording the address of the folder or file attributes of all the files or folders attributes into memory;

[0049] 查找模块,用于在读入内存的所有文件或文件夹属性中遍历查找全部或部分文件或文件夹。 [0049] The searching module, all the files in the file is read into memory or folder attribute of exhaustive searching all or part of the file or folder.

[0050] 进一步地,所述记录获取模块包括: [0050] Further, the recording obtaining module comprises:

[0051] 文件分配表记录获取模块,用于当硬盘分区格式为FAT12,FAT16或FAT32时,从文件分配表获取所有文件或文件夹属性的记录地址,并根据文件或文件夹属性的记录地址将文件分配表中的所有文件或文件夹属性读入内存;和/或 [0051] The file allocation table records obtaining module, configured to, when the format of the hard disk partition FAT12, FAT16, or FAT32, the recording address obtaining all of the files or the folder attributes from the file allocation table, and according to the file or folder attribute record address All files or folders in the file allocation table attribute into memory; and / or

[0052] 主文件表记录获取模块,用于当硬盘分区格式为NTFS时,从主文件表中获取所有文件或文件夹属性的记录地址和属性,并根据文件或文件夹属性的记录地址将主文件表中的所有文件或文件夹属性读入内存。 [0052] The master file table record obtaining module, configured to, when the hard disk partition format is NTFS, and the properties of all the recording address acquiring a file or folder attributes from the master file table, according to the file or folder and the recording address of the main attributes All files or file folder attribute table read into memory.

[0053] 进一步地,所述文件分配表记录获取模块包括: [0053] Further, the file allocation table records obtaining module comprises:

[0054] 文件分配表起始地址和大小获取单元,用于读取BIOS参数块的内容,获取文件分配表的起始地址和大小; [0054] The start address and the file allocation table size obtaining unit for reading the contents of the BIOS parameter block, obtaining start address and size of the file allocation table;

[0055] 记录地址确定单元,用于确定文件分配表中所有文件或文件夹属性所在记录项的记录起止地址; [0055] recording address determination unit configured to determine the file allocation table any file or folder attributes where the recording start and end address item;

[0056] 记录内容读取单元,用于根据确定的所有文件或文件夹属性所在记录项的记录起止地址将文件分配表中所有文件或文件夹属性读入内存。 [0056] The recorded content read unit for determining based on all file or folder attribute record starting and ending addresses of all entries where the file or folder attributes in the file allocation table read into memory.

[0057] 进一步地,所述主文件表记录获取模块包括: [0057] Furthermore, the master file table record obtaining module comprises:

[0058] 主文件表起始地址和大小获取单元,用于读取BIOS参数块的内容,获取主文件表的起始地址和大小; [0058] The master file table starting address and size acquisition unit for reading the contents of the BIOS parameter block, obtaining start address and size of the master file table;

[0059] 记录地址确定单元,用于确定主文件表所有文件或文件夹属性所在记录项的记录起止地址; [0059] recording address determination unit, for determining a master file of all files or folders recording starting and ending address where attribute entry;

[0060] 记录内容读取单元,用于根据确定的所有文件或文件夹属性所在记录项的记录起止地址将主文件表中所有文件或文件夹属性读入内存。 [0060] The recorded content read unit for determining based on all file or folder attribute record starting and ending addresses of the entries where the files or all files in the folder property master file table is read into memory.

[0061] 进一步地,所述主文件表记录获取模块包括: [0061] Furthermore, the master file table record obtaining module comprises:

[0062] 元文件打开单元,用于通过CreateFile打开元文件$MFT来获取整个主文件表的所有文件或文件夹属性的记录地址,并根据所述文件或文件夹属性的记录地址获取所述文件或文件夹属性。 [0062] metafile opening means for opening recorded address by the CreateFile $ MFT metafile entire master file table to obtain the attributes of all the files or folders, and acquiring the address of the record file according to the file or folder properties or folder properties.

[0063] 进一步地,所述查找模块包括: [0063] Furthermore, the searching module comprises:

[0064] 文件或文件夹属性遍历单元,用于遍历每一个文件或文件夹属性,获取文件或文件夹属性信息,以对文件或文件夹进行管理。 [0064] The file or folder attributes traversal unit, configured to traverse each folder or file attributes, file or folder acquired attribute information to a file or folder management.

[0065] 进一步地,所述查找模块包括: [0065] Furthermore, the searching module comprises:

[0066] 属性信息区域确定单元,用于确定主文件表中文件或文件夹属性在其所在记录项中的存储位置,对所述存储位置进行查找。 [0066] The attribute information region determining unit, for determining the master file table in the file or folder attributes in its stored position in the entries, to find the storage location.

[0067] 进一步地,所述装置还包括: [0067] Preferably, said apparatus further comprising:

[0068] 查找条件添加模块,用于根据在查找时加入的文件或文件夹特征作为查找条件, 在读入内存的所有文件或文件夹属性中遍历查找全部或部分文件或文件夹;和 [0068] The search condition adding module, configured to find when added in a file or folder as a search condition characterized, in all documents or files into memory to find the folder attribute traverse all or part of the file or folder; and

[0069] 展示模块,用于展示查找到的文件或文件夹。 [0069] display module for display to find the file or folder.

[0070] 进一步地,所述装置还包括: [0070] Preferably, said apparatus further comprising:

[0071] 处理模块,用于删除查找到的文件或文件夹。 [0071] processing module for deletion find the file or folder.

[0072] 进一步地,所述装置还包括: [0072] Preferably, said apparatus further comprising:

[0073] 文件或文件夹属性记录地址获取模块,用于在出现新的硬盘分区格式,从服务器中获取文件或文件夹属性的记录地址。 [0073] The file or folder attribute record address obtaining module for the emergence of new hard disk partition format, the recording address of a file or folder attributes from the server.

[0074] 进一步地,所述记录获取模块包括: [0074] Further, the recording obtaining module comprises:

[0075] —次读取单元,用于将所有文件或文件夹属性一次读入内存;或 [0075] - reading unit time, for all the files or the folder attributes read into memory; or

[0076] 分段读取单元,用于将所有文件或文件夹属性分段读入内存。 [0076] The reading unit segment, for all the files or folders read into memory segment attributes.

[0077] 与现有技术相比,本发明具有以下优点: [0077] Compared with the prior art, the present invention has the following advantages:

[0078] 本发明的文件或文件夹查找方法和装置通过读取硬盘的主引导记录区中所记载的文件或文件夹属性的记录起始地址,并根据硬盘分区类型来确定每个文件或文件夹属性记录所在记录项的偏移量,从而获取每个文件或文件夹属性的记录起止地址,并可以根据文件或文件夹属性的记录起止地址将所有文件或文件夹属性从硬盘一次或分段读入到内存中,然后在内存中遍历所有的文件或文件夹属性来对文件或文件夹进行查找。 [0078] files or folders of the present invention to find a method and means for guiding the recording start address of the file or record in the area described by the main folder properties of hard to read, and to determine according to each file or hard disk partition type where the recording folder attribute record offset term, thereby obtaining the recording starting and ending addresses of each folder or file attributes, and can be a file or folder attributes according to the recording starting and ending addresses of all the attribute file or folder from a hard disk or segment read into memory and then loop through all of the file or folder properties to a file or folder to find in memory. 此种方式通过一次或几次I/O操作来实现文件或文件夹查找,可以避免因为频繁进行I/O操作而造成的查找速度较慢的情况,提高查找速度以及客户端的响应速度,避免对客户端资源进行不必要的占用。 This way by one or several I / O operations to achieve a file or folder to find, the situation can be avoided because frequent I / O operations caused by the slow search speed, search speed and improve the response speed of the client, to avoid client resources unnecessarily occupied.

附图说明 BRIEF DESCRIPTION

[0079] 图1是本发明的文件或文件夹查找方法实施例一的流程图; [0079] FIG. 1 is a file or folder to find a method of the present invention, a flow diagram embodiment;

[0080] 图2是图1所示的根据硬盘分区格式获取所有文件或文件夹记录方法实施例的流程图; [0080] FIG 2 is a flowchart of all files or folders recording method of the embodiment shown in FIG. 1 acquired according to the format of the hard disk partition;

[0081] 图3是本发明的文件或文件夹查找装置实施例一的结构示意图。 [0081] FIG. 3 is a file or a folder according to the present invention is to find a schematic structural diagram of the apparatus embodiment. 具体实施方式 Detailed ways

[0082] 为使本发明的上述目的、特征和优点能够更加明显易懂,下面结合附图和具体实施方式对本发明作进一步详细的说明。 [0082] For the above-described objects, features and advantages of the invention more apparent, the accompanying drawings and the following specific embodiments of the present invention will be further described in detail.

[0083] 本发明的文件或文件夹查找方法及装置应用于计算机客户端,用于对客户端的硬盘中存储的文件或文件夹进行查找。 [0083] files or folders to find a method of the present invention applied to a computer apparatus and a client, for the client's file or folder is stored in the hard disk to find. 具体的,本申请的文件或文件夹查找方法及装置可以通过计算机程序实现,并安装于客户端中,通过处理器的运行来执行。 Specifically, the present application files or folders to find a method and apparatus may be realized by a computer program, and is attached to the client is performed by running the processor.

[0084] 参照图1,示出本发明的文件或文件夹查找方法的实施例一,包括以下步骤:[0085] 步骤101,读取主引导记录区的内容,获取硬盘分区格式。 [0084] Referring to Figure 1, there is shown an embodiment of the present invention, a file or a folder searching method, comprising the steps of: [0085] Step 101, read the contents of the master boot record area, the hard disk partition format acquired.

[0086] 操作系统可以调用API CreateFile来打开相应的硬盘设备或分区。 [0086] Operating system API CreateFile call to open the respective partition or hard disk device. 从而得到硬盘或分区的句柄,进而读取到主引导记录区(MBR,Master Boot Record)的内容。 Whereby the handle hard disk or partition, and then read the contents of the master boot record area (MBR, Master Boot Record) of.

[0087] 读取主引导记录区的内容判断硬盘分区格式,在主引导记录区中记载有硬盘分区格式的标识,通过读取主引导记录区的内容便可以确定硬盘分区格式。 [0087] The read contents of the master boot record area of ​​the hard disk partition format is determined, discloses a hard disk partition format identified in the master boot record area, it may determine the format of the hard disk partition boot record area by reading the contents of the master. 目前Windows的分区格式包括有FAT12,FATl 6,FAT32 禾口NTFS (New Technology File System)。 Currently Windows partition formats including FAT12, FATl 6, FAT32 Wo mouth NTFS (New Technology File System). 其中对于前3种,硬盘上的所有文件、文件夹信息都记录于文件分配表(FAT,File Allocation Table) 里。 For the first three of which, all files on the hard disk, folder information is recorded in the file allocation table (FAT, File Allocation Table) inside. 对于NTFS分区,所有文件、文件夹信息存储在主文件表(MFT,Master File Table)里。 For NTFS partition, all files, folders in the Master File Table (MFT, Master File Table) where information is stored.

[0088] 步骤102,根据硬盘分区格式获取硬盘中所有文件或文件夹属性的记录地址,并根据所述文件或文件夹属性的记录地址将所有文件或文件夹属性读入内存。 [0088] Step 102. The format of the hard disk partition the hard disk recording address obtaining all the file or folder attribute, and recording the address of the folder or file attributes of all the files or folders attributes into memory.

[0089] 其中,文件或文件夹属性是指名称、大小、创建时间、创建日期、最后访问日期、最后修改日期等等能对文件或文件夹进行识别的特征。 [0089] wherein, the file or folder is the name of the attribute, size, creation time, creation date, last access date, last modification date, etc. of a file or folder can be identified feature.

[0090] 所有文件或文件夹属性记录在文件分配表或主文件表中,其中,其记录的载体与硬盘分区格式对应。 [0090] All files or folders in a file allocation table attribute record or master file table, wherein the record carrier corresponding to the format of the hard disk partition. 分区格式为FAT12,FATl 6或FAT32对应的所有文件或文件夹属性记录在文件分配表中,分区格式为NTFS对应的文件或文件夹属性记录在主文件表中。 The partition as FAT12, FATl 6 all files or folders or FAT32 corresponding attribute record in the file allocation table, the corresponding partition as NTFS file or folder attribute record in the master file table.

[0091] 如果硬盘的分区格式为FAT12,FAT16或FAT32的其中一种,那么读取文件分配表的内容。 [0091] If one of the hard disk partition format FAT12, FAT16, or FAT32, then read the contents of the file allocation table. 如果硬盘的分区格式为NTFS,那么则读取主文件表的内容。 If the hard disk partition formatted as NTFS, then the contents of the master file table read.

[0092] 将所有文件或文件夹属性读入内存可以是一次读入内存,也可以是分段读入内存,即分几次读入,具体的可以根据内存的容量和占用情况来确定。 [0092] The properties of all files or folders may be read into memory once read into memory, may be read into memory segment, i.e. read several times, it may be determined according to the specific capacity and memory occupancy. 例如,当内存足够大的时候,可以选择将所有文件或文件夹属性一次读入内存,当内存不足时,则可以分几次将所有文件或文件夹属性读入内存,从而避免频繁的输入/输出操作以及占用过多的系统资源。 For example, when the memory is large enough, you can select all the files or folders attributes read into memory, when memory is low, you can several times all the files or folders attribute is read into memory, so as to avoid frequent input / output operations and take up too many system resources.

[0093] 参照图2,其中,读取文件分配表的内容的具体过程为: [0093] Referring to Figure 2, which read the contents of the file allocation table of the specific process:

[0094] Dl,读取BPB (BIOS参数块,BIOS Parameter Block)的内容,获取文件分配表的起始地址和大小。 [0094] Dl, reads the contents of BPB (BIOS parameter block, BIOS Parameter Block), and acquires the start address and size of the file allocation table.

[0095] 其中,BPB记录在主引导记录区中,BPB会按照固定的格式来记录文件分配表的起始地址,从主引导记录区可以读取到BPB的内容,通过对BPB内容的分析可以找到BPB对应的记录字节,便可以获取文件分配表的起始地址。 [0095] wherein, in the master boot record recorded BPB area, BPB will follow a fixed format recording start address of the file allocation table, the master boot record from the region may read the contents of the BPB, by analyzing the content may BPB BPB find the corresponding byte records, you can obtain the starting address of the file allocation table.

[0096] 另外,BPB中定义了每扇区字节数、每个簇有几个扇区以及总扇区数。 [0096] Further, in the BPB defines the number of bytes per sector, there are several sectors in each cluster and the total number of sectors. 通过这些文件或文件夹可以计算出每簇的大小=每扇区字节数*每个簇的扇区数。 Clip may calculate the size of each cluster = * bytes per sector number of sectors per cluster these documents or files. BPB中记载了文件分配表所占用的起始簇号及簇的占用数量,从而可以获取文件分配表的大小。 BPB describes a starting cluster number of clusters and the number of file allocation table occupied occupied, thereby obtaining the size of the file allocation table.

[0097] D2,确定文件分配表中所有文件或文件夹属性所在记录项的记录起止地址。 [0097] D2, the file allocation table to determine all the attribute file or folder where the recording start and end address item.

[0098] 一般来说,文件分配表中每一个记录项之间的偏移量是一定的,文件或文件夹属性在每一个记录项中的存储位置也是一定的,在确定文件分配表的起始地址后,可以通过偏移量来获取到每个文件或文件夹属性所在记录项的起止地址,从而确定每个文件或文件夹属性的记录地址。 [0098] In general, the file allocation table offset between each of the entries is constant, the file or folder attributes in each storage location of a record entry is constant, it is determined from the file allocation table after the start address, you may be obtained by adding the offset to each file or folder where the starting and ending address entries attributes, thereby determining the recording address of each file or folder attribute. 例如,文件分配表中的一个记录项的偏移量为10¾个字节,文件或文件夹属性占用前512个字节,那么在确定文件分配表中每个记录项的起止地址后,便可以确定文件或文件夹属性的记录地址。 For example, the offset of a record entry in the file allocation table is 10¾ bytes, the file or folder occupies 512 bytes before the attribute, then the starting and ending addresses of each item record, it can determine the file allocation table determine the file or folder attributes recorded address.

[0099] 通过文件分配表的起始地址、偏移量和大小可以确定文件分配表的终止地址,具体的,通过起始地址和大小,可以计算出文件分配表的终止地址,在通过偏移量来获取起始地址和终止地址之间的所有文件或文件夹属性所在记录项的记录起止地址,从而可以保证文件分配表的所有文件或文件夹属性所在记录项的记录起止地址都能被确定。 [0099] By the start address of the file allocation table, the offset and size can be determined to terminate the address of the file allocation table, particularly, by size and starting address, the end address can be calculated in the file allocation table, by the offset amount to get all files or files between the starting address and ending address record starting and ending address folder properties located entries, which can guarantee that all files or file allocation table folder properties where recording starting and ending address of an item can be determined .

[0100] D3,根据确定的所有文件或文件夹属性所在记录项的记录起止地址将文件分配表中所有文件或文件夹属性读入内存。 [0100] D3, all documents or files to determine the beginning and ending address records folder attributes of all entries where the file or folder attributes in the file allocation table read into memory.

[0101] 在确定文件分配表中所有文件或文件夹属性所在记录项的记录起止地址之后,便可以将整个文件分配表一次性或分段读入内存,包括所有文件或文件夹属性,也即进行一次或几次I/O操作。 After [0101] files or all files in the file allocation table is determined where recording the beginning and ending clip attribute address entry, they may be disposable or the entire file allocation table is read into memory segment, including all file or folder attributes, i.e. once or several I / O operation.

[0102] 读取主文件表的内容的其中一种方式与前述的读取文件分配表的内容的方式相同,即通过BPB获取主文件表的起始地址和大小,然后根据主文件表的偏移量确定主文件表中所有文件或文件夹属性所在记录项的记录起止地址,将整个主文件表所有文件或文件夹属性一次或分段读入内存。 [0102] reads the contents of the master file table of contents where the same manner as one way to read the file allocation table, i.e., obtain the start address and size of the primary file through the BPB table, then according to the partial master file table shift amount determining master file table attributes of all the files or folders recording starting and ending location address entries, the entire master file of all files or folders once or segment attributes into memory.

[0103] 因为NTFS分区的特殊性,读取主文件表的内容还可以直接通过CreateFile打开元文件$MFT来获取整个主文件表的所有文件或文件夹属性所在记录项的记录地址,并根据文件或文件夹属性所在记录项的记录地址来获取文件或文件夹属性,然后将所有文件或文件夹属性一次或分段读入内存中。 [0103] The specificity NTFS partition, read the contents of the master file table can also directly obtain all the files or the entire master file folder attribute table where the entry address by recording CreateFile to open the MFT metafile $, and according to the file or folder attributes where recording address entries to get the file or folder attributes, and then all of a file or folder attributes or segmented into memory.

[0104] 进一步地,还可以获取文件或文件夹在硬盘中的存放位置,从而便于后续查找特定的文件或文件夹以及对所有文件或文件夹进行管理。 [0104] Further, you can also obtain a file or folder in the hard disk storage position, thereby facilitating subsequent lookups specific files or folders, and all documents or folders managed.

[0105] 步骤103,在读入内存的所有文件或文件夹属性中遍历查找全部或部分文件或文件夹。 [0105] Step 103, all the file or folder read into memory properties of exhaustive searching all or part of the file or folder.

[0106] 其中,文件分配表或主文件表里一个记录项对应一个文件或文件夹,通过遍历所有记录项中的文件或文件夹属性将整个分区上的所有文件及文件夹列出,从而可以实现快速查找全部或部分文件或文件夹。 [0106] wherein the file allocation table or master file table entry corresponding to a record or a file folder, by traversing all entries in a file or folder attributes of all the files and folders listed on the entire partition, thereby Quick Search of all or part of the file or folder.

[0107] 对于文件分配表来说,每个记录项占用32个字节,其中,前10个字节是文件名(Dos文件名规则,即短文件名),接下来有1个字节记录文件属性,1个字节是保留的,然后依次是创建时间,创建日期,最后访问日期,总共占用了几个簇,最后修改日期,第一个簇的地址,文件大小。 [0107] For the file allocation table, each record entry occupies 32 bytes, which is the first 10 bytes of the file name (Dos file name rule, i.e. short filename), the next 1 byte records file attributes, one byte is reserved, then followed by creation date, creation date, last access date, a total of taking up several clusters, last modification date, first cluster address, file size. 因为每个数据所占用的字节数较少,因此直接通过遍历整个数据来获取相关的信息。 Because fewer bytes occupied by each of the data, thus acquired information related directly by traversing the entire data. 具体的,从第一个数据的记录起始地址开始,每次偏移数据占用的字节数,即32 个字节,就能遍历所有文件或文件夹信息,以获取文件或文件夹的属性信息。 Specifically, starting from the recording start address of the first data each time the number of bytes occupied by the offset, i.e., 32 bytes, or all files can traverse the folder information, to obtain the attribute file or folder information.

[0108] 对于主文件表来说,每个记录项占用IOM个字节,文件或文件夹属性占用前512 个字节,在确定文件或文件夹所在记录项的记录起始地址后,往后读取512个字节,便可以获取到文件或文件夹的属性信息。 [0108] For the master file table, each record entry occupies IOM bytes, the file or folder attribute occupies 512 bytes before, after determining the file or folder where the recording start address item, back 512 bytes read, will be able to acquire the attribute information of a file or folder. 因此,在查找时,还可以先确定文件或文件夹属性的存储位置,然后再在查找到的存储位置来读取相关属性,无需遍历整个记录项,从而可以节省查找时间。 Therefore, when looking for, you can first determine the location of a file or folder storage properties, and then to look at the storage location to read the related property, without having to traverse the entire entries, which can save search time. 具体的,主文件表中,每个文件或文件夹所有属性信息都记录在该其所在记录项第一个“FILE0”开头的区域往后512个字节中,通过找到第一个“FILE0”开头的区域,然后往后读取512个字节也可以获取到属性信息。 Specifically, the master file table, each file or folder attribute information are all recorded in a recording area of ​​the item which it is a "FILE0" at the beginning of the next 512 bytes, by finding a first "FILE0" the beginning of the region, and then reads the next 512-byte attribute information may be acquired.

[0109] 另外,因为文件分配表或主文件表记录了文件或文件夹的详细信息,因此在查找时,可以加入文件或文件夹特征作为查找条件,在读入内存的所有文件或文件夹属性中遍历查找全部或部分文件或文件夹,从而提高查找速度。 [0109] Further, since the file allocation table or master file table records the detailed information file or folder, so when looking for, may be added a file or folder features as the search condition, all files or read into memory folder properties Find traversing all or part of the file or folder, thereby improving the search speed. 另外,还可以根据需要展示查找到的文件或文件夹。 In addition, the display can also be required to find a file or folder. 其中,查找条件可以包括文件名,创建日期,最后访问日期,大小等等。 Among them, the search criteria may include file name, creation date, last access date, size and so on. 通过添加查找条件可以使本发明的文件或文件夹查找方法应用于多种场景的文件查找,如重复文件或文件夹查找、0字节文件或文件夹查找、指定文件或文件夹查找,以及垃圾文件查找寸寸。 It can be made by adding a search condition file or folder searching method of the present invention is applied to various scenes to find the file, such as files or folders to find duplicate, 0 byte to find a file or folder, to find the specified file or folder, and trash file search begins.

[0110] 进一步地,还可以根据需要删除查找到的文件或文件夹。 [0110] Further, you can also remove the found files or folders as needed. 例如删除重复文件或文件夹、垃圾文件、0字节文件或文件夹等等。 For example, delete duplicate files or folders, junk files, 0 byte file or folder, and so on.

[0111] 进一步地,当出现新的硬盘分区格式时,可以从服务器中获取该分区格式下文件或文件夹属性的记录地址,从而根据文件或文件夹属性的记录地址将文件或文件夹属性读入内存中。 [0111] Further, when a new hard disk partition format, can obtain the recording address of a file or folder attributes in the partition format from the server, thereby recording address of the file or folder attribute file or folder attributes read into memory.

[0112] 下面,以windows操作系统为例对前述的文件或文件夹查找方法进行说明,假设硬盘的分区采用NTFS格式,需要在C盘进行文件查找,那么具体过程如下所述: [0112] Next, an example of the windows operating system to the file or folder searching method will be described, assuming use of the hard disk partition NTFS format, required to find the file in the C drive, then the procedure is as follows:

[0113] 使用Windows API CreateFile来打开目标驱动器,读取前512个字节,S卩引导记录区,从第25字节开始是BPB文件,MFT的起始地址可以从BPB中读取,具体是BPB中的第49-57字节。 [0113] using the Windows API CreateFile destination drive to open, read the first 512 bytes, S Jie boot record area, starting from the BPB file is 25 bytes, the MFT can be read from the start address of the BPB, in particular BPB in 49-57 bytes. 其中BPB中的头两个字节定义了每扇区字节数,接下来的2个字节定义了每个簇有几个扇区,第41字节到49字节是此分区总共有多少扇区。 Wherein the first two bytes of the BPB defines the number of bytes per sector, the next 2 bytes define each cluster has several sectors, the first 41 bytes to 49 bytes total number of this partition sectors. 以上文件或文件夹可以计算出每簇的大小=每扇区字节数*每个簇的扇区数,每簇的大小通常是4KB,但在格式化时也可以指定为其它大小。 Above file or folder can calculate the number of bytes per sector * = number of sectors per cluster size per cluster size of each cluster are typically 4KB, but in another format may also specify the size. 取得MFT地址后再次调用ReadFile来读取整个MFT。 ReadFile call again after obtaining the MFT addresses to read the entire MFT. MFT的每个记录段长度为IOM个字节。 Each record length is IOM bytes MFT.

[0114] 开始遍历MFT来找到所有文件和文件夹。 [0114] traversing MFT to find all the files and folders. 具体方法是:找到第一个“FILE0”开头的区域,往后读取512个字节,所有与这个文件或文件夹相关的属性全部在这512个字节里,包括文件名,是否目录,文件大小,文件所占用的起始簇号,占了多少个簇,创建日期,访问日期等等。 The specific method is: first find a "FILE0" area at the beginning of next reading 512 bytes, all the files or folders related properties of all these 512 bytes in, including the file name, whether the directory, file size, file occupied by the starting cluster number, representing the number of clusters, creation date, access date and so on. 此处,只读前512字节而不是IOM字节,是因为后面512节点是数据段,一些小于512字节的文件会被直接存在MFT里,对查找文件而言,读取前512字节就可以实现查找。 Here, the first read-only bytes 512 bytes instead of IOM, because node 512 is behind the data segment, a number of documents less than 512 bytes will be a direct MFT, the look-up document, read the first 512 bytes look can be achieved. 然后往后偏移IOM字节读取下一个文件内容,以此类推,直至所有文件信息读取完,即可完成查找。 IOM byte offset is then read back the next content file, and so on, until all the file information scanned and, to complete the search.

[0115] 参照图3,示出本发明的一种文件或文件夹查找装置实施例,包括:主引导记录区内容读取模块10、记录获取模块20和查找模块30。 [0115] Referring to FIG 3, shows a file or folder to find the present invention apparatus of the embodiment, comprising: a master boot record area content read module 10, module 20 and acquisition record lookup module 30.

[0116] 主引导记录区内容读取模块10,用于读取主引导记录区的内容,获取硬盘分区格式。 [0116] SUMMARY master boot record area 10 is read module for reading the contents of the master boot record area, the hard disk partition format acquired. 其中,硬盘分区格式通常为FAT12,FAT16,FAT32和NTFS。 Which is usually the hard disk partition format FAT12, FAT16, FAT32 and NTFS.

[0117] 记录获取模块20,用于根据硬盘分区格式获取所有文件或文件夹属性的记录地址,并根据所述文件或文件夹属性的记录地址将所有文件或文件夹属性读入内存。 [0117] recording obtaining module 20, configured to obtain the addresses of all the recording file or folder attribute The hard disk partition format, and recording the address of the folder or file attributes of all the files or folders attributes into memory. 其中,当硬盘分区格式为FAT12,FAT1 6或FAT32时,记录获取模块20为文件分配表记录获取模块, 用于从文件分配表获取所有文件或文件夹属性的记录地址。 Wherein, when the hard disk partition format of FAT12, FAT1 6 or FAT32, the recording module 20 acquires the file allocation table records obtaining module, configured to obtain the addresses of all the recording file or folder from the file allocation table attributes. 当硬盘格式分区为NTFS时,记录获取模块20为主文件表记录获取模块,用于当从主文件表中获取所有文件或文件夹属性的记录地址。 When the format of the hard disk partition to NTFS, acquiring recording module 20 records the file table based acquisition module, configured to obtain the recording address of all properties of a file or folder from the master file table.

[0118] 查找模块30,用于在读入内存的所有文件或文件夹属性中遍历查找全部或部分文件或文件夹。 [0118] searching module 30, configured to traverse all or part of the file to find all files or a file in memory a folder or folder attribute.

[0119] 其中,文件分配表记录获取模块包括文件分配表起始地址和大小获取单元、记录地址确定单元和记录内容读取单元。 [0119] wherein the file allocation table records acquisition module comprises a file allocation table starting address and size obtaining unit, the recording unit and the recording address determination unit content reading. 其中,文件分配表起始地址和大小获取单元,用于读取BPB的内容,获取文件分配表的起始地址和大小。 Wherein the start address and the file allocation table size obtaining unit for reading the contents of BPB, obtain the start address and size of the file allocation table. 记录地址确定单元,用于确定文件分配表中所有文件或文件夹的记录起止地址。 Recording address determination unit for determining a recording starting and ending addresses of all the file allocation table file or folder. 记录内容读取单元,用于根据确定的所有文件或文件夹属性所在记录项的记录起止地址将文件分配表中所有文件或文件夹属性读入内存。 Recorded content read unit for determining based on all file or folder attribute record starting and ending addresses of all entries where the file or folder attributes in the file allocation table read into memory.

[0120] 主文件表记录获取模块包括主文件表起始地址和大小获取单元、记录地址确定单元和记录内容读取单元。 [0120] Master File Table records obtaining module comprises a master file table starting address and size obtaining unit, the recording unit and the recording address determination unit content reading. 其中,主文件表起始地址和大小获取单元,用于读取BPB的内容, 获取主文件表的起始地址和大小。 Wherein the master file table starting address and size acquisition unit for reading the contents of BPB, obtaining start address and size of the master file table. 记录地址确定单元,用于确定主文件表所有文件或文件夹的记录起止地址。 Recording address determination unit, for determining a master file table records the starting and ending addresses of all files or folders. 记录内容读取单元,用于根据确定的所有文件或文件夹属性所在记录项的记录起止地址将主文件表中所有文件或文件夹属性读入内存。 Recorded content read unit for determining based on all file or folder attribute record starting and ending addresses of the entries where the files or all files in the folder property master file table is read into memory.

[0121] 另外,主文件表记录获取模块也可以包括元文件打开单元,用于通过CreateFile 打开元文件$MFT来获取整个主文件表的所有文件或文件夹属性的记录地址,并根据所述文件或文件夹属性的记录地址获取所述文件或文件夹属性。 [0121] In addition, master file table record obtaining module may also include a metafile opening means for opening $ MFT metafile records acquired by CreateFile addresses of all files or the entire master file folder attribute table, and according to the file or folder attribute obtaining the recording address of a file or folder attributes.

[0122] 进一步地,查找模块包括文件或文件夹属性遍历单元和/或属性信息区域确定模块。 [0122] Furthermore, the searching module comprises a file or folder traversal unit attributes and / or attribute information area determination module. 其中,文件或文件夹属性遍历单元用于遍历每一个文件或文件夹属性,获取文件或文件夹属性。 Wherein, the file or folder attribute traversing unit for traversing a file or folder for each attribute, get file or folder attributes. 属性信息区域确定模块,用于确定主文件表中文件或文件夹属性的存储位置,对所述存储位置进行查找。 Attribute information area determining means for determining the position of the master file table storage file or folder attribute, to find the storage location.

[0123] 进一步地,文件或文件夹查找装置还包括查找条件添加模块和展示模块。 [0123] Further, the file or folder to find means further comprises adding module and a search condition display module. 查找条件添加模块,用于在查找时加入加入的文件或文件夹特征作为查找条件。 Search condition adding module for adding the added when searching for a file or folder as a search condition characteristics. 例如,文件名,创建日期,最后访问日期,大小等等的查找条件。 For example, file name, creation date, last access date, size, etc. of the search criteria. 展示模块,用于展示查找到的文件或文件夹。 Display module for display to find the file or folder.

[0124] 进一步地,文件或文件夹查找装置还包括处理模块,用于删除查找到的文件或文件夹。 [0124] Further, to find a file or folder apparatus further includes a processing module for deleting the searched file or folder.

[0125] 进一步地,文件或文件夹查找装置还包括文件或文件夹属性夹记录地址获取模块,用于在出现新的硬盘分区格式,从服务器中获取文件或文件夹属性的记录地址。 [0125] Further, the file or folder to find means further comprises a clip file or folder attribute record address obtaining module, for the emergence of new hard disk partition format, the recording address of a file or folder attributes from the server.

[0126] 进一步地,所述记录获取模块还包括一次读取单元,用于将所有文件或文件夹属一次读入内存;或分段读取单元,用于将所有文件或文件夹属性分段读入内存。 [0126] Further, the recording module further comprises obtaining a reading unit for all files or folders belong to read into memory; read unit or segment, for all the files or folders segment attributes read into memory.

[0127] 本发明的文件或文件夹查找方法和装置通过读取主引导记录区中所记载的文件或文件夹记录的起始地址和大小来确定每个文件或文件夹记录的地址,从而将所有文件或文件夹记录一次或分段读入到内存中,然后在内存中遍历所有的文件或文件夹记录来对文件进行查找。 [0127] files or folders of the present invention to find a method and apparatus to determine the address of each file or folder by reading the master boot record clamp record start address and size of the file or recording region described thereby All files or folders recorded once or segments read into memory and then iterate through all the files in the folder or file in memory records to locate the file. 此种方式通过一次或几次I/O操作来实现文件查找,可以避免因为频繁进行I/O操作而造成的查找速度较慢的情况,提高查找速度以及客户端的响应速度,避免对客户端资源进行不必要的占用。 This way by one or several I / O operations to achieve file search, the situation can be avoided because frequent I / O operations caused by the slow search speed, search speed and improve the response speed of the client and avoid client resource unnecessary occupation.

[0128] 本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。 [0128] In the present specification, various embodiments are described in a progressive way, differences from the embodiment and the other embodiments each of which emphasizes embodiment, various portions of the same embodiment of similarity between the embodiments refer to each other. 对于装置实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。 For the apparatus of the embodiment, since the method of the embodiment which is substantially similar, the description is relatively simple, the relevant part of the embodiment of the method embodiments to be described.

[0129] 以上对本发明所提供的文件或文件夹查找方法和装置进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。 [0129] or more folders to find a file or the present invention provides a method and apparatus are described in detail herein through specific examples of the principles and embodiments of the present invention have been set forth in the above description of embodiments merely for understanding the method and the core idea of ​​the present invention; while those of ordinary skill in the art, according to the ideas of the present invention, there are modifications to the specific embodiments and application scope, summary, the specification shall not construed as limiting the present invention.

Claims (27)

1. 一种文件或文件夹查找方法,其特征在于,包括以下步骤:读取主引导记录区的内容,获取硬盘分区格式;根据硬盘分区格式获取硬盘中所有文件或文件夹属性的记录地址,并根据所述文件或文件夹属性的记录地址将所有文件或文件夹属性读入内存;在读入内存的所有文件或文件夹属性中遍历查找全部或部分文件或文件夹。 A method to find a file or folder, characterized by comprising the steps of: reading the contents of the master boot record area, the hard disk partition obtain format; recording address obtaining all of the hard disk a file or folder attribute format The hard disk partition, and recording the address of the folder or file attributes of all the files or folders into memory attributes; all documents or files into memory to find the folder attribute traverse all or part of the file or folder.
2.如权利要求1所述的方法,其特征在于,所述根据硬盘分区格式获取所有文件或文件夹属性的记录地址,并根据所述文件或文件夹属性的记录地址将所有文件或文件夹属性读入内存包括:若硬盘分区格式为FAT12,FAT16或FAT32,从文件分配表获取所有文件或文件夹属性的记录地址,并根据文件或文件夹属性的记录地址将文件分配表中的所有文件或文件夹属性读入内存;和/或若硬盘分区格式为NTFS,从主文件表中获取所有文件或文件夹属性的记录地址,并根据文件或文件夹属性的记录地址将主文件表中的所有文件或文件夹属性读入内存。 2. The method according to claim 1, wherein said recording address obtaining all of the files or the folder properties The hard disk partition format, and recording the address of the folder or file attributes of all the files or folders properties read into memory comprising: if the hard disk partition format of FAT12, FAT16, or FAT32, obtaining records the addresses of all the file or folder attribute from the file allocation table, and the recording address of the file or folder attributes of all the files file allocation table or folder attributes into memory; and / or if the hard disk partition format, the recording address of all the file or folder attributes from the master file table to NTFS, and recording address attribute of the document or folder master file table All file or folder attributes read into memory.
3.如权利要求2所述的方法,其特征在于,所述从文件分配表获取所有文件或文件夹属性的记录地址,并根据文件或文件夹属性的记录地址将文件分配表中的所有文件或文件夹属性读入内存包括:读取BIOS参数块的内容,获取文件分配表的起始地址和大小;确定文件分配表中所有文件或文件夹属性所在记录项的记录起止地址;根据确定的所有文件或文件夹属性所在记录项的记录起止地址将文件分配表中所有文件或文件夹属性读入内存。 3. The method according to claim 2, wherein said recording address obtaining all of the files or folders from the attribute file allocation table, and all the files in the folder the file allocation table recording address or a file according to the file attribute or folder attributes into memory comprises: reading the contents of the BIOS parameter block, obtaining start address and size of the file allocation table; determining the file allocation table any file or folder attributes where the recording start and end address item; determined according to All file or folder attributes where entries record the starting and ending addresses of the file allocation table or all the files in the folder properties read into memory.
4.如权利要求2所述的方法,其特征在于,所述从主文件表中获取所有文件或文件夹属性的记录地址,并根据文件或文件夹属性的记录地址将主文件表中的所有文件或文件夹属性读入内存包括:读取BIOS参数块的内容,获取主文件表的起始地址和大小;确定主文件表中所有文件或文件夹属性所在记录项的记录起止地址;根据确定的所有文件或文件夹属性所在记录项的记录起止地址将主文件表中所有文件或文件夹属性读入内存。 4. The method according to claim 2, wherein said recording address obtaining all of the files or the folder attributes from the master file table, and recording address of a file or folder to attribute all the master file table file or folder attributes into memory comprises: reading the contents of the BIOS parameter block, obtaining start address and size of the master file table; master file table determining all attribute file or folder where the recording start and end address item; determined according to All file or folder attributes where recording starting and ending addresses of all entries file or folder attributes in the master file table is read into memory.
5.如权利要求2所述的方法,其特征在于,所述从主文件表中获取所有文件或文件夹属性的记录地址,并根据文件或文件夹属性的记录地址将主文件表中的所有文件或文件夹属性读入内存包括:通过CreateFile打开元文件$MFT来获取整个主文件表的所有文件或文件夹属性所在记录项的记录地址,并根据所述文件或文件夹属性所在记录项的记录地址获取所述文件或文件夹属性。 5. The method according to claim 2, wherein said recording address obtaining all of the files or the folder attributes from the master file table, and recording address of a file or folder to attribute all the master file table file or folder attributes into memory comprising: acquiring the addresses of all files or records the entire master file folder attribute table entries where $ MFT metafile opening through CreateFile, and according to entries to the file or folder attributes located obtaining the recording address of a file or folder attributes.
6.如权利要求1所述的方法,其特征在于,所述在内存中所有文件或文件夹属性中遍历查找包括:遍历每一个文件或文件夹属性,获取文件或文件夹的属性信息,以对文件或文件夹进行管理。 6. The method according to claim 1, wherein all of the files or folders in the memory lookup traversal attribute comprises: traversing each file or folder attributes, acquires the attribute information of a file or folder, to a file or folder management.
7.如权利要求2所述的方法,其特征在于,所述在内存中所有文件或文件夹属性中遍历查找,包括:确定文件分配表或主文件表的起始地址;从起始地址开始,依次偏移文件或文件夹属性所在记录项所占用的字节数,直至遍历完成。 7. The method according to claim 2, characterized in that, in the memory of all the files or the folder properties of exhaustive searching, comprising: determining a master file allocation table or file start address table; from the start address sequentially offset in the file or folder attributes where the number of bytes occupied by items recorded until complete traversal.
8.如权利要求7所述的方法,其特征在于,所述在内存中所有数据属性中遍历查找包括:确定主文件表中文件或文件夹属性在其所在记录项中的存储位置,在所述存储位置进行查找。 8. The method according to claim 7, characterized in that all of the data in memory to find traversal attribute comprises: determining a master file table in the file or folder attributes in its stored position in the entries in the said storage location to find.
9.如权利要求1所述的方法,其特征在于,所述在读入内存的所有文件或文件夹属性中遍历查找全部或部分文件或文件夹包括:根据在查找时加入的文件或文件夹特征作为查找条件,在读入内存的所有文件或文件夹属性中遍历查找全部或部分文件或文件夹;并将查找到的文件或文件夹展示。 9. The method according to claim 1, characterized in that, in all the files or the folder into memory properties of exhaustive searching all or part of the files or folders comprising: the added when searching for a file or folder wherein a search condition, all files or files in a folder into memory properties of exhaustive searching all or part of the files or folders; and to find a file or folder to display.
10.如权利文件9所述的方法,其特征在于,所述查找条件包括以下一种或多种:文件名、文件夹名、创建日期、最后访问日期和大小。 10. The method of claim 9 files, wherein the search criteria comprises one or more of the following: file name, folder name, creation date, last access date, and size.
11.如权利要求10所述的方法,其特征在于,所述指定文件或文件夹的查找包括以下一种或几种:重复文件或文件夹查找、0字节文件或文件夹查找、指定文件或文件夹查找,以及垃圾文件查找。 The specified file or folder to find duplicate files, 0 bytes to find a file or folder,: 11. The method according to claim 10, wherein searching the specified file or folder comprises one or more or folder to find, and find junk files.
12.如权利要求11所述的方法,其特征在于,所述方法还包括删除所述查找到的文件或文件夹。 12. The method according to claim 11, wherein said method further comprises deleting the found file or folder.
13.如权利要求1所述的方法,其特征在于,所述方法还包括:若出现新的硬盘分区格式,从服务器中获取文件或文件夹属性的记录地址。 13. The method according to claim 1, wherein said method further comprises: if the new hard disk partition format occurs, acquiring recording address of a file or folder attributes from the server.
14.如权利要求1所述的方法,其特征在于,所述硬盘中所有文件或文件夹属性包括以下一种或多种:名称、大小、创建时间、创建日期、最后访问日期、最后修改日期。 14. The method according to claim 1, characterized in that all the hard disk a file or folder attribute comprises one or more of: name, size, creation time, creation date, last access date, last modification date .
15.如权利要求14所述的方法,其特征在于,所述方法还包括:根据硬盘分区格式获取硬盘中所有文件或文件夹的存放位置。 15. The method according to claim 14, wherein said method further comprises: obtaining storage position the hard disk all the files or folders The hard disk partition format.
16.如权利要求1至15任一项所述的方法,其特征在于,所述将所有文件或文件夹属性读入内存包括:将所有文件或文件夹属性一次读入内存;或将所有文件或文件夹属性分段读入内存。 Or all files; all files or folders once read into memory attributes: 1 to 16. The method according to any of claim 15, wherein all of the files or the folder attributes into memory comprising or folder attributes read into memory segment.
17. 一种文件或文件夹查找装置,其特征在于,包括:主引导记录区内容读取模块,用于读取主引导记录区的内容,获取硬盘分区格式;记录获取模块,用于根据硬盘分区格式获取硬盘中所有文件或文件夹属性的记录地址,并根据所述文件或文件夹属性的记录地址将所有文件或文件夹属性读入内存;查找模块,用于在读入内存的所有文件或文件夹属性中遍历查找全部或部分文件或文件夹。 17. An apparatus for searching for a file or folder, wherein, comprising: a master boot record area content reading means for reading the contents of the master boot record area, the hard disk partition obtain format; record obtaining module, according to a hard disk Get partition format the hard disk recording address all the file or folder attribute, and recording the address of the folder or file attributes of all the files or folders attributes into memory; searching module, configured to read into memory all files or folder attributes in the traversal to find all or part of the file or folder.
18.如权利要求17所述的装置,其特征在于,所述记录获取模块包括:文件分配表记录获取模块,用于当硬盘分区格式为FAT12,FAT16或FAT32时,从文件分配表获取所有文件或文件夹属性的记录地址,并根据文件或文件夹属性的记录地址将文件分配表中的所有文件或文件夹属性读入内存;和/或主文件表记录获取模块,用于当硬盘分区格式为NTFS时,从主文件表中获取所有文件或文件夹属性的记录地址和属性,并根据文件或文件夹属性的记录地址将主文件表中的所有文件或文件夹属性读入内存。 18. The apparatus according to claim 17, wherein said recording acquisition module comprising: a file allocation table records obtaining module, configured to, when the format of the hard disk partition FAT12, FAT16, or FAT32, the acquisition of all files from the file allocation table or folder attribute recording address, and the recording address of a file or folder attributes of all the files or folders in the file allocation table attribute into memory; and / or master file table record obtaining module, configured to, when the hard disk partition format It is NTFS, and the properties of all the recording address acquiring a file or folder attributes from the master file table, and all files or folders in the master file table attribute into memory recording address folder or file according to the file attribute.
19.如权利要求18所述的装置,其特征在于,所述文件分配表记录获取模块包括: 文件分配表起始地址和大小获取单元,用于读取BIOS参数块的内容,获取文件分配表的起始地址和大小;记录地址确定单元,用于确定文件分配表中所有文件或文件夹属性所在记录项的记录起止地址;记录内容读取单元,用于根据确定的所有文件或文件夹属性所在记录项的记录起止地址将文件分配表中所有文件或文件夹属性读入内存。 19. The apparatus according to claim 18, characterized in that, the file allocation table records acquisition module comprising: a file allocation table starting address and size acquisition unit for reading the contents of the BIOS parameter block, obtain the file allocation table the start address and size; recording address determination unit for determining a recording starting and ending addresses of all the file allocation table file or folder attribute record entry is located; recorded content read unit for determining the attributes of all the files or folders record the starting and ending addresses where the entries of the file allocation table, file or folder attributes all read into memory.
20.如权利要求18所述的装置,其特征在于,所述主文件表记录获取模块包括:主文件表起始地址和大小获取单元,用于读取BIOS参数块的内容,获取主文件表的起始地址和大小;记录地址确定单元,用于确定主文件表所有文件或文件夹属性所在记录项的记录起止地址;记录内容读取单元,用于根据确定的所有文件或文件夹属性所在记录项的记录起止地址将主文件表中所有文件或文件夹属性读入内存。 20. The apparatus according to claim 18, wherein said master file table record obtaining module comprises: a master file table starting address and size acquisition unit for reading the contents of the BIOS parameter block, obtain master file table the start address and size; recording address determination unit for determining a master file of all files or folders recording starting and ending address where attribute entry; recorded content read unit, based on the determined attributes for all clip file or its recording the recording start and end address item master file or all the files in the folder attribute file table read into memory.
21.如权利要求18所述的装置,其特征在于,所述主文件表记录获取模块包括: 元文件打开单元,用于通过CreateFile打开元文件$MFT来获取整个主文件表的所有文件或文件夹属性的记录地址,并根据所述文件或文件夹属性的记录地址获取所述文件或文件夹属性。 21. The apparatus according to claim 18, wherein said master file table record obtaining module comprises: a meta file opening unit for opening by $ MFT metafile CreateFile to get all the files or the entire master file table clip recorded address attribute, and acquires the file or folder attributes recording the address of the folder or file attributes.
22.如权利要求17所述的装置,其特征在于,所述查找模块包括:文件或文件夹属性遍历单元,用于遍历每一个文件或文件夹属性,获取文件或文件夹属性信息,以对文件或文件夹进行管理。 22. The apparatus according to claim 17, wherein the searching module comprises: a file or folder attribute traversing means for traversing each file or folder attribute, a file or folder acquired attribute information to for file or folder management.
23.如权利要求17所述的装置,其特征在于,所述查找模块包括:属性信息区域确定单元,用于确定主文件表中文件或文件夹属性在其所在记录项中的存储位置,对所述存储位置进行查找。 23. The apparatus according to claim 17, wherein the searching module comprises: attribute information area determining means for determining a master file table, the file or folder attributes in its stored position in the record entry of to find the storage location.
24.如权利要求17所述的装置,其特征在于,所述装置还包括:查找条件添加模块,用于根据在查找时加入的文件或文件夹特征作为查找条件,在读入内存的所有文件或文件夹属性中遍历查找全部或部分文件或文件夹;和展示模块,用于展示查找到的文件或文件夹。 24. The apparatus according to claim 17, characterized in that said apparatus further comprising: search condition adding module, configured to find the added when a file or folder as a search condition wherein all documents read into memory or folder attributes traversal to find all or part of the files or folders; and a display module for displaying the searched file or folder.
25.如权利要求M所述的装置,其特征在于,所述装置还包括: 处理模块,用于删除查找到的文件或文件夹。 25. The apparatus of claim M, wherein said apparatus further comprises: a processing module for deleting the searched file or folder.
26.如权利要求17所述的装置,其特征在于,所述装置还包括:文件或文件夹属性记录地址获取模块,用于在出现新的硬盘分区格式,从服务器中获取文件或文件夹属性的记录地址。 26. The apparatus according to claim 17, wherein said apparatus further comprises: a file or folder attribute record address acquiring module, for the emergence of new hard disk partition format, obtained from the server file or folder attributes address of record.
27.如权利要求17至沈任一项所述的装置,其特征在于,所述记录获取模块包括:一次读取单元,用于将所有文件或文件夹属性一次读入内存;或分段读取单元,用于将所有文件或文件夹属性分段读入内存。 27. The device according to any one of claims 17 Shen, wherein said recording obtaining module comprises: a reading unit for all the files or folders attributes read into memory; read or segments access unit, for all the files or folders read into memory segment attributes.
CN2011101639540A 2011-06-17 2011-06-17 Find the file or folder method and apparatus CN102289451A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2011101639540A CN102289451A (en) 2011-06-17 2011-06-17 Find the file or folder method and apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN2011101639540A CN102289451A (en) 2011-06-17 2011-06-17 Find the file or folder method and apparatus
PCT/CN2012/076359 WO2012171434A1 (en) 2011-06-17 2012-05-31 Method and device for finding files or folders

Publications (1)

Publication Number Publication Date
CN102289451A true CN102289451A (en) 2011-12-21

Family

ID=45335883

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2011101639540A CN102289451A (en) 2011-06-17 2011-06-17 Find the file or folder method and apparatus

Country Status (2)

Country Link
CN (1) CN102289451A (en)
WO (1) WO2012171434A1 (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012171434A1 (en) * 2011-06-17 2012-12-20 北京奇虎科技有限公司 Method and device for finding files or folders
CN103198119A (en) * 2013-04-02 2013-07-10 浪潮电子信息产业股份有限公司 Method for fast searching all chained files having same repeating data deleting identification
CN104699688A (en) * 2013-12-04 2015-06-10 杭州鹰湾科技有限公司 File searching method and electronic device
CN104915462A (en) * 2015-07-14 2015-09-16 魅族科技(中国)有限公司 File management method and system
CN105045528A (en) * 2015-06-24 2015-11-11 武汉烽火众智数字技术有限责任公司 Fast FAT32 disk partition traversal and file searching method
CN105868820A (en) * 2015-12-15 2016-08-17 乐视移动智能信息技术(北京)有限公司 U disk device identification method and apparatus, and mobile device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1341237A (en) * 1999-10-21 2002-03-20 松下电器产业株式会社 Semiconductor memory card access apparatus, computer-readable recording medium, an initialization method, and semiconductor memory card
CN101650737A (en) * 2009-09-15 2010-02-17 福州瑞芯微电子有限公司 Method for rapidly opening files based on FAT system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100444166C (en) * 2005-12-16 2008-12-17 北京中星微电子有限公司 Position-based interface access method and device for FAT file system
CN102289451A (en) * 2011-06-17 2011-12-21 奇智软件(北京)有限公司 Find the file or folder method and apparatus

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1341237A (en) * 1999-10-21 2002-03-20 松下电器产业株式会社 Semiconductor memory card access apparatus, computer-readable recording medium, an initialization method, and semiconductor memory card
CN101650737A (en) * 2009-09-15 2010-02-17 福州瑞芯微电子有限公司 Method for rapidly opening files based on FAT system

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012171434A1 (en) * 2011-06-17 2012-12-20 北京奇虎科技有限公司 Method and device for finding files or folders
CN103198119A (en) * 2013-04-02 2013-07-10 浪潮电子信息产业股份有限公司 Method for fast searching all chained files having same repeating data deleting identification
CN104699688A (en) * 2013-12-04 2015-06-10 杭州鹰湾科技有限公司 File searching method and electronic device
CN105045528A (en) * 2015-06-24 2015-11-11 武汉烽火众智数字技术有限责任公司 Fast FAT32 disk partition traversal and file searching method
CN104915462A (en) * 2015-07-14 2015-09-16 魅族科技(中国)有限公司 File management method and system
CN105868820A (en) * 2015-12-15 2016-08-17 乐视移动智能信息技术(北京)有限公司 U disk device identification method and apparatus, and mobile device

Also Published As

Publication number Publication date
WO2012171434A1 (en) 2012-12-20

Similar Documents

Publication Publication Date Title
JP4510028B2 (en) Adaptive Read Ahead techniques for multiple read stream
CN104395904B (en) Efficient storage and retrieval of data objects
US5983317A (en) Storage device and method for data sharing
CN101228523B (en) System and method for caching network file systems
JP4494420B2 (en) Adaptation file read-ahead based on multiple factors
CN102741800B (en) Delete duplicate data storage system
US6789094B2 (en) Method and apparatus for providing extended file attributes in an extended attribute namespace
CN101276366B (en) Computer system preventing storage of duplicate files
US7860907B2 (en) Data processing
US7610296B2 (en) Prioritized files
JP4799936B2 (en) By condition snapshot acquisition method and system
US8239648B2 (en) Reclamation of thin provisioned disk storage
JP5224706B2 (en) Control method of a storage device and storage device
CN101258493B (en) System and method for performing a search operation within a sequential access data storage subsystem
US7765189B2 (en) Data migration apparatus, method, and program for data stored in a distributed manner
JP5427533B2 (en) Transfer method and system of duplicate files in a hierarchical storage management system
CN102541475B (en) The method of data storage and data storage means
US8983952B1 (en) System and method for partitioning backup data streams in a deduplication based storage system
CN102934097B (en) Data de-duplication
JP4315876B2 (en) File management program, file management method, and file management system
KR101422557B1 (en) Predictive data-loader
JP4943081B2 (en) File storage control apparatus and method
CN102012790A (en) Storage device having direct user access
US8315995B1 (en) Hybrid storage system
CN101706825A (en) Replicated data deleting method based on file content types

Legal Events

Date Code Title Description
C06 Publication
C10 Entry into substantive examination
C12 Rejection of a patent application after its publication