CN100347705C - Method for file merge - Google Patents

Method for file merge Download PDF

Info

Publication number
CN100347705C
CN100347705C CNB2004101025500A CN200410102550A CN100347705C CN 100347705 C CN100347705 C CN 100347705C CN B2004101025500 A CNB2004101025500 A CN B2004101025500A CN 200410102550 A CN200410102550 A CN 200410102550A CN 100347705 C CN100347705 C CN 100347705C
Authority
CN
China
Prior art keywords
file
source file
source
memory location
merging
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.)
Expired - Fee Related
Application number
CNB2004101025500A
Other languages
Chinese (zh)
Other versions
CN1622094A (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.)
Vimicro Corp
Original Assignee
Vimicro Corp
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 Vimicro Corp filed Critical Vimicro Corp
Priority to CNB2004101025500A priority Critical patent/CN100347705C/en
Publication of CN1622094A publication Critical patent/CN1622094A/en
Application granted granted Critical
Publication of CN100347705C publication Critical patent/CN100347705C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The present invention discloses a method for file merging to solve the problems that adopting the prior art to merge files occupies a great amount of system resources and is limited by a storage space. The method comprises the following steps: the source files needed to be merged and the merging order of each source file are determined; a new file is established and used as a target file after merging; the staring position of a first source file of the merging order in a memory is used as the starting position of the target file; the total length of all the source file is used as the length of the target file and is recorded in a file description list of the file; a chain list describing storage position for files is modified in a file system so that a final storage position of a front source file in the merging order is assigned to a starting storage position of a next source file; the description lists of all the source files are deleted in the file system.

Description

A kind of method of merged file
Technical field
The present invention relates to the file system technology of the computing machine and the communications field, relate in particular to a kind of in file system the method for merged file.
Background technology
In the practical application of computing machine, often need merge a plurality of files according to a definite sequence.As, when by multimedia hardware when file system writes data, generally comprise the data of video and audio frequency, and the standard (as AVI) of common video and voice playing file need be merged into the Voice ﹠ Video data logical file.
Current file merging method is at first to read source data, and then writes target data, deletes source data at last.As shown in Figure 1 and Figure 2, four source file A, B, C, D among Fig. 1 are merged into the process of the file destination A1 among Fig. 2.Source file A, B, C, D take bunches 10 to bunches 29, during merging respectively with these file copy between another memory block, merge back file destination A1 and take bunches 40 to 59.
Often be subjected to the restriction of remaining space when under general applied environment, big file being merged.For example, when needing the file on the backup hard disk, generally need break into bag (ZIP, TAR, forms such as RAR) to them, if disk space is not enough, these operations can not be carried out.The surplus of disk space many times is proportional with the data volume that operation merges.For example the disk total volume has 10GB and data with existing 6GB; Need back up the data of 6GB this moment and wait operation, merging becomes a file, and owing to remaining space has only 4GB, this operation can't be performed.
From the above, there is following shortcoming in existing file merging method:
1, owing to need carry out reading of data, write data and deletion data operation, therefore, not only combined efficiency system resource low and that take is many, but also can cause too much data fragment.
If 2 remaining space deficiencies (less than the size of data of source file) can't be carried out the file union operation, therefore, be subjected to the restriction of storage space.
Summary of the invention
In view of this, the invention provides a kind of method of merged file, have the problem that takies a large amount of system resources and be subjected to storage space limitations when adopting the prior art merged file to solve.
For addressing the above problem, the invention provides following technical scheme:
A kind of method of merged file is used for a plurality of files on the storer are merged into a file in order, and this method comprises the steps:
A, the definite source file of merging and merge order of each source file of needing;
B, new file of establishment are as the file destination after merging, and with the reference position of first source file in storer in the described merge order as the reference position of this file destination and with the total length of all source files as the length records of this file destination in the file description table of this file destination;
The chained list of description document memory location in C, the revised file system makes the last memory location of previous source file in the described merge order point to the initial memory location of a back source file;
D, in file system the deletion all source files file description table.
Described step C comprises the steps:
C1, with first source file in the described merge order as current source file;
C2, the list item of in the chained list of description document memory location, searching the last memory location of describing current source file and the initial memory location that obtains a back source file of current source file according to merge order;
The list item of the last memory location of current source file is described in C3, modification, makes the initial memory location of next the described back of sensing, memory location one source file in this list item;
C4, determine whether described back one source file is last source file in described merge order, if then finish to revise, otherwise afterwards a source file is as current source file and change step C2.
Because adopting merged file of the present invention mainly makes amendment to the chained list of file description table and description document memory location, do not need copy data (read and write data) and remove former data, therefore, not only occupying system resources is few, and the combined efficiency height, produce the data fragment hardly; Only need few storage space in the merged file process, the storer less to remaining space also can carry out the file union operation.
Description of drawings
Fig. 1 is the file allocation hoist pennants of four files in the prior art;
Fig. 2 is the synoptic diagram of merged file in the prior art;
Fig. 3, Fig. 4 are the process flow diagram of merged file of the present invention;
Fig. 5 is the synoptic diagram after the present invention merges file shown in Fig. 1.
Embodiment
Mainly (File Allocation Table, FAT) the present invention will be described for file system with file allocation table for present embodiment.The file that needs in the present invention to merge is called source file, and the file after the merging is called file destination.
File system in the computer system is mainly finished three functions: follow the tracks of and record storage in the quilt space and the free space that are consumed, the physical storage locations of each file is followed the tracks of and write down to maintenance directory name and filename.The FAT file system adopts file description table (FDT) to come the attribute information of log file, as the reference position of storage file, file size (size) etc.; Show the physical storage locations of log file by FAT, the FAT table is a kind of chained list that is used for data in magnetic disk (file) index and location in the FAT file system, in the table each file of recording storage bunch number.Bunch (Cluster) is that the physical location (address) with a certain linear range forms a management unit, is a sector as the least unit of disk, and one bunch can comprise two, four even more sector as required.
The present invention when merged file, the file description table (FDT) by modify target file and revise the purpose that FAT shows to reach merged file.Consulting Fig. 3, is example with source file A, B shown in the combined diagram 1, C, D, and its main process is as follows:
Step 1, the definite title (comprising routing information) of each source file and putting in order of merging that needs merging.As: incoming source document name: A, B, C, D, putting in order during merging: first is source file A, and second is source file B, and the 3rd is source file C, and the 4th is source file D.
Step 2, in file system, create a new file as the file destination E after merging.If the name of file destination is called certain filename in the source file, then should make its path difference.
Step 3, determine the total length of all source files and put in order in the initial memory location of first source file.
File description table by query source file A, B, C, D obtains the length of each source file, calculates total length then, simultaneously, obtains bunch number (as bunch 0 among the figure) of initial memory location from the file description table of source file A.
Reference position in the file description table of step 4, modify target file E and file size with the length of the file total length that calculates in the step 3 as file destination E, are made the reference position of source file bunch numbers 10 the initial memory location of file destination E.
Step 5, revise the FAT table, make the last memory location of previous source file in putting in order point to the initial memory location of a back source file.That is:
Starting cluster 15 with the pointed source file B of last bunch 14 following cluster of source file A storage;
Starting cluster 20 with the pointed source file C of last bunch 19 following cluster of source file B storage;
Starting cluster 25 with the pointed source file D of last bunch 24 following cluster of source file C storage;
Do not revise (this following cluster pointed of last bunch is an end mark) for last bunch of source file D storage.
Step 6, in file system the file description table of deletion source file A, B, C, D.
Consult shown in Figure 4ly, step 5 may further comprise the steps:
Step 51, first source file in will putting in order are as current source file.
Step 52, in FAT table, find last bunch of the current source file of storage, obtain according to putting in order current source file a back source file initial storage bunch.
Step 53, with the initial storage of a source file after last bunch the following cluster pointed of preceding source file storage bunch.
Step 54, judge whether described back one source file is last source file in putting in order, if then finish, otherwise, should a back source file as current source file and change step 52.
The FAT table is revised in step 55, end.
By after 4 execution in step 52 to 54, promptly obtain the result in the above-mentioned steps 5.
Consult shown in Figure 5, the physical storage locations of file destination in storer after the present invention merges four files shown in Figure 1 do not change, and be that file description table and FAT table have produced variation, the file description table that is original four source file A, B, C, D is deleted, and the memory location of four source files links in order.
From the above do not need copy data (read and write data) and remove former data, therefore, not only occupying system resources is few, and the combined efficiency height, produces the data fragment hardly; Only need few storage space in the merged file process, the storer less to remaining space also can carry out the file union operation
Though present embodiment is illustrated with the FAT file system, is not limited in this, the present invention is equally applicable to new technology file system (being used for operating systems such as Windows2000/Windows XP).Above-mentioned storer includes but not limited to floppy disk, hard disk and flash memory etc.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.

Claims (4)

1, a kind of method of merged file is used for a plurality of files on the storer are merged into a file in order; It is characterized in that comprising the steps:
A, the definite source file of merging and merge order of each source file of needing;
B, new file of establishment are as the file destination after merging, and with the reference position of first source file in storer in the described merge order as the reference position of this file destination and with the total length of all source files as the length records of this file destination in the file description table of this file destination;
The chained list of description document memory location in C, the revised file system makes the last memory location of previous source file in the described merge order point to the initial memory location of a back source file;
D, in file system the deletion all source files file description table.
2, the method for claim 1 is characterized in that step C comprises the steps:
C1, with first source file in the described merge order as current source file;
C2, the list item of in the chained list of description document memory location, searching the last memory location of describing current source file and the initial memory location that obtains a back source file of current source file according to merge order;
The list item of the last memory location of current source file is described in C3, modification, makes the initial memory location of next the described back of sensing, memory location one source file in this list item;
C4, determine whether described back one source file is last source file in described merge order, if then finish to revise, otherwise afterwards a source file is as current source file and change step C2.
3, the method for claim 1 is characterized in that, described file system includes but not limited to FAT system and new technology file system.
4, as each described method of claim 1 to 3, it is characterized in that described storer includes but not limited to floppy disk, hard disk and flash memory.
CNB2004101025500A 2004-12-24 2004-12-24 Method for file merge Expired - Fee Related CN100347705C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2004101025500A CN100347705C (en) 2004-12-24 2004-12-24 Method for file merge

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2004101025500A CN100347705C (en) 2004-12-24 2004-12-24 Method for file merge

Publications (2)

Publication Number Publication Date
CN1622094A CN1622094A (en) 2005-06-01
CN100347705C true CN100347705C (en) 2007-11-07

Family

ID=34766811

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2004101025500A Expired - Fee Related CN100347705C (en) 2004-12-24 2004-12-24 Method for file merge

Country Status (1)

Country Link
CN (1) CN100347705C (en)

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007109180A (en) * 2005-10-17 2007-04-26 Canon Inc Document processing device and method
CN100386761C (en) * 2005-10-26 2008-05-07 北京和利时系统工程股份有限公司 Data file merging method
CN100419760C (en) * 2005-12-16 2008-09-17 北京中星微电子有限公司 File segmenting method and device for FAT file system
CN103517135B (en) * 2012-06-28 2017-02-08 Tcl集团股份有限公司 Method, system and television capable of playing MP4-format video files continuously
US9336056B2 (en) * 2013-12-31 2016-05-10 International Business Machines Corporation Extendible input/output data mechanism for accelerators
CN105528348B (en) * 2014-09-28 2020-03-20 阿里巴巴集团控股有限公司 Media file processing method and device
CN106611024B (en) * 2015-10-27 2020-08-11 北京国双科技有限公司 File merging method and device
CN106021536A (en) * 2016-05-27 2016-10-12 成都索贝数码科技股份有限公司 Data insertion method and system based on storage of FICS objects
CN106021217A (en) * 2016-05-27 2016-10-12 成都索贝数码科技股份有限公司 Editing method and system of large-file data stored based on FICS objects
CN106095794A (en) * 2016-05-27 2016-11-09 成都索贝数码科技股份有限公司 A kind of Piece file mergence method and system based on the storage of FICS object
CN108874297A (en) * 2017-05-10 2018-11-23 华为技术有限公司 Merge method, storage device, storage equipment and the storage medium of file
CN107329765B (en) * 2017-07-04 2020-09-04 武汉斗鱼网络科技有限公司 Program file processing method and device
CN107644056B (en) * 2017-08-04 2021-02-12 武汉烽火众智数字技术有限责任公司 File storage method, device and system
CN107729558B (en) * 2017-11-08 2021-06-29 郑州云海信息技术有限公司 Method, system and device for defragmenting file system and computer storage medium
CN109413487A (en) * 2018-11-07 2019-03-01 成都索贝数码科技股份有限公司 A method of spelling is dodged after storing fragment transcoding/synthetic video file based on object

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1291304A (en) * 1998-10-20 2001-04-11 皇家菲利浦电子有限公司 File systems supporting data sharing
WO2003003216A1 (en) * 2001-05-31 2003-01-09 Matsushita Electric Industrial Co., Ltd. Information providing method, provided information recording apparatus, provided information reading apparatus, and cooking-related device
CN1113304C (en) * 1998-09-18 2003-07-02 英业达股份有限公司 Method for merging files
CN1517906A (en) * 2003-01-14 2004-08-04 联想(北京)有限公司 Document system and document management method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1113304C (en) * 1998-09-18 2003-07-02 英业达股份有限公司 Method for merging files
CN1291304A (en) * 1998-10-20 2001-04-11 皇家菲利浦电子有限公司 File systems supporting data sharing
WO2003003216A1 (en) * 2001-05-31 2003-01-09 Matsushita Electric Industrial Co., Ltd. Information providing method, provided information recording apparatus, provided information reading apparatus, and cooking-related device
CN1517906A (en) * 2003-01-14 2004-08-04 联想(北京)有限公司 Document system and document management method

Also Published As

Publication number Publication date
CN1622094A (en) 2005-06-01

Similar Documents

Publication Publication Date Title
CN100347705C (en) Method for file merge
CN102129458B (en) Method and device for storing relational database
CN1020014C (en) Method of rapidly opening disk files identified by path names
CN110825748B (en) High-performance and easily-expandable key value storage method by utilizing differentiated indexing mechanism
US9043540B2 (en) Systems and methods for tracking block ownership
CN1619544A (en) Method and apparatus for data processing
US20060212495A1 (en) Method and system for storing data into a database
CN103631940A (en) Data writing method and data writing system applied to HBASE database
CN105912687A (en) Mass distributed database memory cell
CN1750164A (en) Digital hard disc recorder file managing method for preventing file fragment production
CN103064639A (en) Method and device for storing data
CN105912675B (en) A kind of batch deletion/querying method and device merged for small documents
CN102289451A (en) Method and device for searching files or folders
CN101042703A (en) Method for managing metadata of file system using dbms
CN101051317A (en) FAT file system and its processing method
CN1614591A (en) Method for organizing and accessing distributive catalogue of document system
KR100907477B1 (en) Apparatus and method for managing index of data stored in flash memory
CN101034416A (en) Method for file seek track using file allocation table and system frame thereof
JP6531574B2 (en) Storage device, storage device control program and storage device control method
US9483469B1 (en) Techniques for optimizing disk access
CN1776687A (en) File segmenting method and device for FAT file system
CN1271522C (en) A linear file accessing method
CN1492363A (en) Data storage and searching method of embedded system
CN111831423A (en) Method and system for realizing Redis memory database on nonvolatile memory
CN112506922A (en) Embedded IoT time sequence database design method for hybrid solid-state storage 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
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20071107

Termination date: 20111224