CN100464333C - File name generating method and device in file distribution system - Google Patents

File name generating method and device in file distribution system Download PDF

Info

Publication number
CN100464333C
CN100464333C CNB2007100991216A CN200710099121A CN100464333C CN 100464333 C CN100464333 C CN 100464333C CN B2007100991216 A CNB2007100991216 A CN B2007100991216A CN 200710099121 A CN200710099121 A CN 200710099121A CN 100464333 C CN100464333 C CN 100464333C
Authority
CN
China
Prior art keywords
short filename
filename
unicode
file
short
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
CNB2007100991216A
Other languages
Chinese (zh)
Other versions
CN101051319A (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 CNB2007100991216A priority Critical patent/CN100464333C/en
Publication of CN101051319A publication Critical patent/CN101051319A/en
Application granted granted Critical
Publication of CN100464333C publication Critical patent/CN100464333C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

A method for generating file name in file distribution system includes utilizing Unicode code to generate long file name based on standard of file distribution system, judging whether generated file name is over 8 characters or not, selecting partial Unicode from Unicode of long file name and using it as character portion of short file to generate name field of relevant short file if it is or otherwise directly using Unicode of long file name as content of short file name field to generate relevant short file name.

Description

Filename generation method in the file allocation system and generating apparatus
Technical field
The present invention relates to filename generation method and generating apparatus in FAT (File Allocation Table, file allocation table) system, particularly file allocation system.
Background technology
The FAT file system is the file system of a kind of hyperdisk data space of Microsoft's definition, show to manage the whole magnetic disk space by FAT, comprise these 3 kinds of file system of FAT12, FAT16 and FAT32 at present, satisfy the space management of different memory space ranges, base unit in these 3 kinds of file system of FAT12, FAT16 and FAT32 in the FAT table is respectively 12 bit, 16 bit or 32 bit.
In the FAT file system, defined a root directory area (Root Directory Region), be used to store the data item under the root directory.
In the FAT file system, the basic storage cell of root directory area is clauses and subclauses (entry), its structure comprises following field: Name (name of file or catalogue) as shown in Figure 1, Ext (extension name), Attr (attribute), Case, Time_ms (time), Create time (creation-time), Create date (date created), Accessdate (the last visit date), Start cluster HI (high position of the starting cluster in file or catalogue corresponding data district), Modify time (the last modification time), Modify date (the last modification date), Startcluster LO (low level of the starting cluster in file or catalogue corresponding data district) and File size (file size).
The all corresponding entry item of each file, an entry item accounts for 32 byte, and root directory area is exactly enumerating of all entry items, if entry has arrived end, promptly do not had next effectively entry, FAT is by representing the byte0 zero setting of entry the end of entry.
Can find that from the entry structure of directory area traditional FAT is conditional on the length of file, dirname, name is 8 characters, expansion 3 characters by name, i.e. 8.3 naming rules of often saying.Describe for convenient in the present invention, with 8.3 naming rule corresponding file name called after short filenames.
FAT supports by the definition of having expanded entry in order to realize name is surpassed the support of the filename of 8 characters, in the present invention, describes for convenient, with its called after long filenames.
FAT sets gradually expansion entry item by the front at regular file entry and stores long filenames, and expansion entry as shown in Figure 2.
Being constructed as follows of short filename:
" character part "+"~"+" numerical portion "+". "+" suffix portion "
Short filename normally " preceding several characters "+"~"+" numeral "+". "+" suffix portion " of long filenames constitutes, the short filename corresponding as " The quick brown fox.exe " is " Thequi~1.fox ", if a similar long filenames of title is arranged again, as " The quick brownfoxl.exe ", then corresponding short filename is " Thequi~2.fox ".
In the above-mentioned filename processing scheme, long filenames adopts the Unicode coding, and short filename adopts current system coding, as the GB sign indicating number of Chinese platform, and Korean coding etc.So just relate to Unicode coding and local coder two cover codings, for the system of some limited storage space, many cover codings must increase the pressure of storage, have increased expense.
Summary of the invention
The purpose of this invention is to provide filename generation method and generating apparatus in a kind of file allocation system, reduce the quantity of coding, and then reduce resource overhead.
To achieve these goals, the invention provides the filename generation method in a kind of file allocation system, wherein, comprising:
Step 31 according to file allocation system standard, adopts the Unicode coding to generate long filenames;
Step 32 judges whether the filename that generates surpasses 8 characters, if enter step 33, otherwise enter step 34;
Step 33, selected part Unicode coding from the Unicode of long filenames coding carries out after the compatible pre-service character part as short filename, and behind definite short filename numerical portion, generates the name field of corresponding short filename;
Step 34, directly the Unicode with long filenames encodes as the content of short filename name field, generates corresponding short filename.
Above-mentioned method, wherein, this compatibility pretreatment operation is specially: 0 character conversion in the part Unicode coding that will choose is 0X30.
Above-mentioned method, wherein, the part Unicode that chooses in the described step 33 is encoded in the long filenames Unicode coding top one or more.
Above-mentioned method, wherein, determine in the described step 33 that the short filename numerical portion specifically comprises:
Steps A is selected a numeral, combines with the Unicode coding of selecting and generates an interim short filename;
Step B by the filename of the All Files of traversal under the current directory, judges that this interim short filename is whether identical with the filename of file under the current directory, if return steps A, otherwise enter step C;
Step C is with the numeral selected in the steps A numerical portion as short filename.
Above-mentioned method, wherein, the short filename numerical portion of determining in the described step 33 is specially: obtain current sector ID and this sector has been used number of entries, and utilize this current sector ID and this sector to use number of entries to determine the numerical portion of one first numerical value as short filename, first numerical value that should determine be: with the ID of current sector as beginning, the formed numeral of having used in conjunction with current sector of number of entries adds the numerical value after 1, the number of entries that has used described current sector is 2, and two of less thaies then mend 0.In order better to realize that above-mentioned purpose, the present invention also provide the file name generation apparatus in a kind of file allocation system, wherein, comprising:
The long filenames generation module is used for according to file allocation system standard, adopts the Unicode coding to generate long filenames;
Judge module is used to judge whether the filename of generation surpasses 8 characters, if handled by the first short filename generation module, otherwise handled by the second short filename generation module;
The first short filename generation module, be used for Unicode coding selected part Unicodc coding from long filenames, carry out after the compatible pre-service character part, and behind definite short filename numerical portion, generate the name field of corresponding short filename as short filename;
The second short filename generation module is used for direct Unicode with long filenames and encodes as the content of short filename name field, generates corresponding short filename.
Above-mentioned device, wherein, this compatibility pretreatment operation is specially: 0 character conversion in the part Unicode coding that will choose is 0X30.
Above-mentioned device, wherein, the part Unicode that the described first short filename generation module is chosen is encoded in the long filenames Unicode coding top one or more.
Above-mentioned device, wherein, described short filename numerical portion is: as beginning, the formed numeral of having used in conjunction with current sector of number of entries adds the numerical value after 1 with the ID of current sector, the number of entries that has used described current sector is 2, and two of less thaies then mend 0.
Method and apparatus of the present invention is handled by adopting Unicode to encode the character in the short filename, has saved a cover coding, has therefore reduced the resource overhead of system; Simultaneously, for the numerical value in the short filename, the present invention is further combined with the canned data of existing file name under the current directory, and to utilize this canned data be that the short filename of new file is determined a numerical value, the numerical value that has the numerical portion of short filename under the numerical value that should determine and the current directory is in a ratio of unique, has accelerated the formation speed of filename.
Description of drawings
Fig. 1 is a root directory area discal patch purpose structural representation;
Fig. 2 is the structural representation of extended entry;
Fig. 3 is the schematic flow sheet of method of the present invention;
Fig. 4 is the structural representation of device of the present invention;
Embodiment
Filename generation method and generating apparatus in the file allocation of the present invention system for long filenames in the file allocation system and the unified Unicode coding that uses of short filename, have reduced the resource overhead of system.
Filename generation method in the file allocation of the present invention system comprises the steps: as shown in Figure 3
Long filenames generates step 31, according to file allocation system standard, adopts the Unicode coding to generate long filenames;
Determining step 32 judges whether the filename that generates surpasses 8 characters, if enter step 33, otherwise enter step 34;
First short filename generates step 33, selected part Unicode coding from the Unicode coding of long filenames, carry out after the compatible pre-service character part, and behind definite short filename numerical portion, generate the name field of corresponding short filename as short filename;
Second short filename generates step 34, and directly the Unicode with long filenames encodes as the content of short filename name field, generates corresponding short filename.
File name generation apparatus in the file allocation of the present invention system comprises as shown in Figure 4:
The long filenames generation module is used for according to file allocation system standard, adopts the Unicode coding to generate long filenames;
Judge module is used to judge whether the filename of generation surpasses 8 characters, if handled by the first short filename generation module, otherwise handled by the second short filename generation module;
The first short filename generation module, be used for Unicode coding selected part Unicode coding from long filenames, carry out after the compatible pre-service character part, and behind definite short filename numerical portion, generate the name field of corresponding short filename as short filename;
The second short filename generation module is used for direct Unicode with long filenames and encodes as the content of short filename name field, generates corresponding short filename.
Yet for the long filenames that guarantees file as far as possible and the correspondence of short filename, the Unicode that selects in the step 33 is encoded in the long filenames Unicode coding top one or more.
As can be seen from the above description, in processing procedure, need carry out compatible pre-service to the part Unicode coding of choosing, this compatibility pretreatment operation is specially: 0 character conversion in the part Unicode coding that will choose is 0X30.Because when long filenames is English alphabet, because can comprise 0 character among the Unicode of letter, windows is incompatible like this, thus for the windows compatibility, 0 character conversion in needing this Unicode encoded be 0X30.
As can be seen from the above description, when long filenames surpasses 8 characters, when utilizing method and apparatus of the present invention to generate corresponding short filename, need obtain a numeral, as the numerical portion of short filename, at this, this action of determining the short filename numerical portion can realize by the following method: determine a numeral behind the filename of the All Files under the traversal current directory, guarantee that file do not bear the same name, specifically comprise:
Steps A is selected a numeral, combines with the Unicode coding of selecting and generates an interim short filename;
Step B by the filename of the All Files of traversal under the current directory, judges that this interim short filename is whether identical with the filename of file under the current directory, if return steps A, otherwise enter step C;
Step C is with the numeral selected in the steps A numerical portion as short filename.
Yet there is following problem in above-mentioned scheme of fixing a number word really:
When file is a lot of under the catalogue, in order to generate short filename, need the filename of the All Files under the traversal current directory, guarantee that with this file do not bear the same name, this process will expend the considerable time.
Therefore, the present invention further proposes the method for the numeral of a definite numerical portion, further accelerates the speed that filename generates under the situation that reduces coding.
The present invention is by obtaining the canned data of existing file name under the current directory, and to utilize this canned data be that the short filename of new file is determined a numerical value, and the numerical value that has the numerical portion of short filename under this numerical value of determining and the current directory is in a ratio of unique.
Below with different canned datas be the example logarithm value determine further specify.
The canned data of this existing file name can be to create the place sector ID of filename of new file and the information that this sector has been used clauses and subclauses, and the numerical value of the numerical portion of the name field of the short filename of the new file of current establishment is:
The ID of current sector is as beginning, and the formed numeral of having used in conjunction with current sector of number of entries (be 2, two of less thaies mend 0) adds the numerical value after 1, illustrates as follows:
Suppose that current directory has taken preceding 5 clauses and subclauses of the 2nd sector, the 5th sector and the 6th sector, when then creating new file again, the numerical portion of its short filename name field is 605.
Its realization comprises the steps:
Obtain first bunch that current directory is stored;
First bunch of bunch chained list that finds this catalogue in the file allocation table according to this current catalogue;
In the traversal this document allocation table behind bunch chained list of this catalogue the clauses and subclauses of the sector ID of current sector and current sector use number;
As beginning, the formed numeral of having used in conjunction with current sector of number of entries (be 2, two of less thaies mend 0) adds the numerical value that obtains after 1 numerical portion as the name field of the short filename of the new file of current establishment with the ID of current sector.
By above-mentioned method, utilize sector ID also can form a numerical value in conjunction with the sector Entry ID, the numerical value of the numerical portion of existing short filename is compared under this numerical value and the current directory, must be for unique.
The above only is a preferred implementation of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.

Claims (9)

1. the filename generation method in the file allocation system is characterized in that, comprising:
Step 31 according to file allocation system standard, adopts the Unicode coding to generate long filenames;
Step 32 judges whether the described long filenames that generates surpasses 8 characters, if enter step 33, otherwise enter step 34;
Step 33, selected part Unicode coding from the Unicode of long filenames coding carries out after the compatible pre-service character part as short filename, and behind definite short filename numerical portion, generates the name field of corresponding short filename, end process;
Step 34, directly the Unicode with long filenames encodes as the content of short filename namc field, generates corresponding short filename.
2. method according to claim 1 is characterized in that, this compatibility pretreatment operation is specially: 0 character conversion in the part Unicode coding that will choose is 0X30.
3. method according to claim 2 is characterized in that, the part Unicode that chooses in the described step 33 is encoded in the long filenames Unicode coding top one or more.
4. method according to claim 1 and 2 is characterized in that, determines in the described step 33 that the short filename numerical portion specifically comprises:
Steps A is selected a numeral, combines with the described part Unicode coding of selecting and generates an interim short filename;
Step B by the filename of the All Files of traversal under the current directory, judges that interim short filename is whether identical with the filename of file under the current directory, if return steps A, otherwise enter step C;
Step C is with the numeral selected in the steps A numerical portion as short filename.
5. method according to claim 1 and 2, it is characterized in that, the short filename numerical portion of determining in the described step 33 is specially: obtain current sector ID and this sector has been used number of entries, and utilize this current sector ID and this sector to use number of entries to determine the numerical portion of one first numerical value as short filename, first numerical value that should determine be: with the ID of current sector as beginning, the formed numeral of having used in conjunction with current sector of number of entries adds the numerical value after 1, the number of entries that has used described current sector is 2, and two of less thaies then mend 0.
6. the file name generation apparatus in the file allocation system is characterized in that, comprising:
The long filenames generation module is used for according to file allocation system standard, adopts the Unicode coding to generate long filenames;
Judge module is used to judge whether the described long filenames of generation surpasses 8 characters, if handled by the first short filename generation module, otherwise handled by the second short filename generation module;
The first short filename generation module, be used for Unicode coding selected part Unicode coding from long filenames, carry out after the compatible pre-service character part, and behind definite short filename numerical portion, generate the name field of corresponding short filename as short filename;
The second short filename generation module is used for direct Unicode with long filenames and encodes as the content of short filename name field, generates corresponding short filename.
7. device according to claim 6 is characterized in that, this compatibility pretreatment operation is specially: 0 character conversion in the part Unicode coding that will choose is 0X30.
8. device according to claim 7 is characterized in that, the part Unicode that the described first short filename generation module is chosen is encoded in the long filenames Unicode coding top one or more.
9. according to claim 6 or 7 described devices, it is characterized in that, described short filename numerical portion is: with current sector ID is beginning, the formed numeral of having used in conjunction with current sector of number of entries adds the numerical value after 1, the number of entries that has used described current sector is 2, and two of less thaies then mend 0.
CNB2007100991216A 2007-05-11 2007-05-11 File name generating method and device in file distribution system Expired - Fee Related CN100464333C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2007100991216A CN100464333C (en) 2007-05-11 2007-05-11 File name generating method and device in file distribution system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2007100991216A CN100464333C (en) 2007-05-11 2007-05-11 File name generating method and device in file distribution system

Publications (2)

Publication Number Publication Date
CN101051319A CN101051319A (en) 2007-10-10
CN100464333C true CN100464333C (en) 2009-02-25

Family

ID=38782731

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2007100991216A Expired - Fee Related CN100464333C (en) 2007-05-11 2007-05-11 File name generating method and device in file distribution system

Country Status (1)

Country Link
CN (1) CN100464333C (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101169796B (en) * 2007-11-20 2012-01-11 中兴通讯股份有限公司 Method for storing document name and judging file name overlength
DE102009045382A1 (en) * 2009-10-06 2011-04-07 Robert Bosch Gmbh Method for analyzing e.g. path name of sound file utilized for playing on DVD player, involves forming checksum with respect to cut part of file name and added to file name that is reduced around cut part
CN102567325B (en) * 2010-12-14 2013-11-27 无锡华润矽科微电子有限公司 Method for analyzing file name of FAT(file allocation table)file system
CN105204823B (en) * 2014-05-29 2019-11-05 腾讯科技(深圳)有限公司 Generate the method and device of application program installation kit
CN104391943A (en) * 2014-11-25 2015-03-04 车智互联(北京)科技有限公司 Production method of date-containing fixed-length character string image name
CN106227830A (en) * 2016-07-25 2016-12-14 乐视控股(北京)有限公司 Storage and the method and apparatus reading file
CN108108376B (en) * 2016-11-25 2021-07-09 中标软件有限公司 Linear self-adaptive file name length scheduling system and method
CN107566506B (en) * 2017-09-15 2020-03-10 华为技术有限公司 Data access method and device
CN107784119A (en) * 2017-11-16 2018-03-09 郑州云海信息技术有限公司 A kind of method that feature name number of words limits in solution SAP system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5579517A (en) * 1993-04-01 1996-11-26 Microsoft Corporation Common name space for long and short filenames
US5765169A (en) * 1996-09-30 1998-06-09 International Business Machines Corporation Method and apparatus for converting long file names to short file names
CN1914602A (en) * 2004-03-31 2007-02-14 松下电器产业株式会社 File name generation apparatus

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5579517A (en) * 1993-04-01 1996-11-26 Microsoft Corporation Common name space for long and short filenames
US5765169A (en) * 1996-09-30 1998-06-09 International Business Machines Corporation Method and apparatus for converting long file names to short file names
CN1914602A (en) * 2004-03-31 2007-02-14 松下电器产业株式会社 File name generation apparatus

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
Windows95/98长文件名的奥秘. 廖逢钗.三明职业大学学报,第3期. 2000
Windows95/98长文件名的奥秘. 廖逢钗.三明职业大学学报,第3期. 2000 *
解析FAT文件系统对长文件名的支持. 陈代军.成都信息工程学院学报,第18卷第4期. 2003
解析FAT文件系统对长文件名的支持. 陈代军.成都信息工程学院学报,第18卷第4期. 2003 *

Also Published As

Publication number Publication date
CN101051319A (en) 2007-10-10

Similar Documents

Publication Publication Date Title
CN100464333C (en) File name generating method and device in file distribution system
CN100492365C (en) File name generating method and device in file distribution system
CN110083805B (en) Method and system for converting Word file into EPUB file
US10891018B2 (en) Displaying a set of data elements
JP4017659B2 (en) Text input font system
KR20060045659A (en) Method and system for renaming consecutive keys in a b-tree
CN101576929B (en) Fast vocabulary entry prompting realization method
US7272792B2 (en) Kana-to-kanji conversion method, apparatus and storage medium
US8862989B2 (en) Extensible input method editor dictionary
US20080306949A1 (en) Inverted index processing
CN104035993A (en) Memory search method for e-books, e-book management system and reading system
CN101008940A (en) Method and device for automatic processing font missing
US8914377B2 (en) Methods for prefix indexing
CN101158955A (en) Construct method of Chinese word stock
US9020977B1 (en) Managing multiprotocol directories
JP2007042146A (en) Method and system of creating and using chinese data and user-corrected data
US20030220914A1 (en) Method for managing data in a network
TWI262403B (en) Multi-language system and method for quickly selecting a font file corresponding to a character from a font database
CN102508690A (en) Storing method and decoding method for command line of embedded equipment
CN105740374A (en) Distributed memory based three-dimensional platform data fuzzy query method
CN115017098A (en) File system management method and device
Kanda et al. Practical rearrangement methods for dynamic double‐array dictionaries
CN108600856A (en) The recognition methods of plug-in subtitle language and device in video file
CN100397399C (en) Method and device for supporting multi-languages in FAT file system
CN112181910A (en) Extended short file name generation method, file access method and equipment

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: 20090225

Termination date: 20120511