CN112269761B - File format conversion method, device, medium and equipment based on symbolic link - Google Patents

File format conversion method, device, medium and equipment based on symbolic link Download PDF

Info

Publication number
CN112269761B
CN112269761B CN202011299712.XA CN202011299712A CN112269761B CN 112269761 B CN112269761 B CN 112269761B CN 202011299712 A CN202011299712 A CN 202011299712A CN 112269761 B CN112269761 B CN 112269761B
Authority
CN
China
Prior art keywords
file
format conversion
symbolic link
task
file format
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011299712.XA
Other languages
Chinese (zh)
Other versions
CN112269761A (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.)
CAPITAL UNIVERSITY OF ECONOMICS AND BUSINESS
Beihang University
Original Assignee
CAPITAL UNIVERSITY OF ECONOMICS AND BUSINESS
Beihang University
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 CAPITAL UNIVERSITY OF ECONOMICS AND BUSINESS, Beihang University filed Critical CAPITAL UNIVERSITY OF ECONOMICS AND BUSINESS
Priority to CN202011299712.XA priority Critical patent/CN112269761B/en
Publication of CN112269761A publication Critical patent/CN112269761A/en
Application granted granted Critical
Publication of CN112269761B publication Critical patent/CN112269761B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/116Details of conversion of file system types or formats
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The disclosure relates to a file format conversion method, device, medium and electronic equipment based on symbolic link, wherein the method comprises the following steps: responding to a file format conversion task, establishing a symbolic link for an original file, wherein the symbolic link points to the original file and carries task attribute information of the file format conversion task; acquiring task attribute information in the symbolic link; and carrying out format conversion on the original file based on the task attribute information to obtain a target file. According to the scheme, the file format conversion can be realized relatively quickly, the file format conversion efficiency is high, and the operation is relatively simple and convenient. Meanwhile, file format conversion is realized based on symbolic links, and the method is independent of a specific operating system and a file system and independent of a database and can be used in a cross-platform manner. In addition, the symbolic link does not occupy a data area of a file system, and only occupies a directory area, so that the disk overhead is low. Overall, the scheme of the embodiment has the advantages of light weight, rapidness, cross-platform performance and the like.

Description

File format conversion method, device, medium and equipment based on symbolic link
Technical Field
The disclosed embodiments relate to the field of computer technologies, and in particular, to a symbolic link-based file format conversion method, a symbolic link-based file format conversion apparatus, and a computer-readable storage medium and an electronic device that implement the symbolic link-based file format conversion method.
Background
Data format conversion refers to lossy or lossless conversion of data from one storage format to another storage format, so as to achieve the purposes of data compression, data processing (such as filtering, reconstruction, and the like), adaptation for specific application, and the like. Specific data formats may be required for specific applications, for example, data formats required for data visualization and data analysis calculation may be different, data formats required for different computer aided design or analysis software may also be different, and data formats or data compression rates required for Web applications or mobile applications may also be different according to network bandwidth.
Data format conversion is typically an industry or domain specific, complex and time consuming data processing process. Therefore, the existing data format conversion method usually stores the data to be converted and the related state and attribute information in a database in a list form for mass data in a specific format, and the data management program calls the format conversion program to perform data format conversion by reading the information in the database.
The existing data format conversion method depends on a database, database software needs to be installed, and format conversion can be interrupted or cannot be carried out if the database fails. In addition, certain time overhead and memory space overhead are generated when the database is accessed during data format conversion, and the database is not an optimal solution.
Disclosure of Invention
In order to solve the technical problems or at least partially solve the technical problems, embodiments of the present disclosure provide a symbolic link-based file format conversion method, a symbolic link-based file format conversion apparatus, and a computer-readable storage medium and an electronic device implementing the symbolic link-based file format conversion method.
In a first aspect, an embodiment of the present disclosure provides a file format conversion method based on symbolic links, including:
responding to a file format conversion task, establishing a symbolic link for an original file, wherein the symbolic link points to the original file and carries task attribute information of the file format conversion task;
acquiring task attribute information in the symbolic link;
and carrying out format conversion on the original file based on the task attribute information to obtain a target file.
In some embodiments of the present disclosure, the file format conversion task includes a batch conversion task that instructs format conversion on a plurality of original files;
the response file format conversion task establishes symbolic link for the original file, and comprises the following steps:
responding to the batch conversion task, and creating a batch conversion catalog;
and respectively establishing corresponding symbolic links for the plurality of original files in the batch conversion directory, wherein each symbolic link points to the corresponding original file and carries task attribute information of a conversion task of the corresponding original file.
In some embodiments of the present disclosure, the plurality of original files includes a first original file and a second original file located in a folder, and the method further includes:
creating a first subdirectory under the batch conversion directory, wherein the first subdirectory is used for storing a second original file;
establishing a corresponding symbolic link for a first original file in the batch conversion directory;
and establishing a corresponding symbolic link for the second original file in the first subdirectory.
In some embodiments of the present disclosure, the plurality of original files includes a third original file located in the same folder, and the method further comprises:
creating a second subdirectory under the batch conversion directory, wherein the second subdirectory is used for storing a third original file;
and establishing a corresponding symbolic link for a third original file in the second subdirectory.
In some embodiments of the present disclosure, the obtaining task attribute information in the symbolic link includes:
traversing all symbolic links under each directory;
and acquiring task attribute information of each symbolic link in all symbolic links.
In some embodiments of the present disclosure, the task attribute information includes file format information indicating a file format of a target file after converting an original file format and a file format conversion parameter;
the converting the format of the original file based on the task attribute information to obtain a target file comprises the following steps:
acquiring file format information and file format conversion parameters in the task attribute information;
calling a corresponding file format conversion tool based on the file format information;
and the file format conversion tool performs format conversion on the original file based on the file format conversion parameter to obtain a corresponding target file.
In some embodiments of the present disclosure, the method further comprises:
and creating symbol link names when each symbol link is established, wherein each symbol link name carries corresponding task attribute information, and each symbol link under the same directory has different symbol link names.
In a second aspect, an embodiment of the present disclosure provides a file format conversion apparatus based on symbolic links, including:
the symbolic link establishing module is used for responding to a file format conversion task and establishing a symbolic link for an original file, wherein the symbolic link points to the original file and carries task attribute information of the file format conversion task;
the attribute information acquisition module is used for acquiring task attribute information of the symbol link;
and the file format conversion module is used for carrying out format conversion on the original file based on the task attribute information to obtain a target file.
In a third aspect, the disclosed embodiments provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the file format conversion method based on symbolic link according to any one of the above embodiments.
In a fourth aspect, an embodiment of the present disclosure provides an electronic device, including:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to execute the steps of the symbolic link based file format conversion method of any of the above embodiments via execution of the executable instructions.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure has the following advantages:
in the embodiment of the disclosure, after a user initiates a file format conversion task, a symbolic link can be established for an original file to be converted, the symbolic link points to the original file and carries task attribute information of the file format conversion task, then the task attribute information in the symbolic link can be obtained, and finally, format conversion is performed on the original file based on the task attribute information to obtain a target file. Therefore, the scheme of the embodiment of the disclosure points to the original file to be converted by using the symbol link, and carries the task attribute information of the file format conversion task by using the symbol link, so that the description and storage process of the data format conversion task information can be simplified, the file format conversion is realized based on the symbol link, the symbol link is independent of a database, and only the support of a file system is needed, so that the time overhead and the memory space overhead of accessing the database are not needed, the speed of directly reading and writing the file pointed by the symbol link and the symbol link is higher, the file format conversion can be realized relatively quickly, the file format conversion efficiency is high, and the operation is relatively simple and convenient. Meanwhile, file format conversion is realized based on symbolic links, and the method is independent of a specific operating system and a file system and can be used in a cross-platform mode. In addition, the symbolic link does not occupy a data area of the file system, and only occupies a directory area, so that the disk overhead is low. Overall, the scheme of the embodiment has the advantages of light weight, rapidness, cross-platform performance and the like.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present disclosure, the drawings used in the embodiments or technical solutions in the prior art description will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive labor.
FIG. 1 is a flowchart of a file format conversion method based on symbolic linking according to an embodiment of the present disclosure;
FIG. 2 is a flowchart of a file format conversion method based on symbolic link according to another embodiment of the present disclosure;
FIG. 3 is a flowchart illustrating a file format conversion method based on symbolic link according to another embodiment of the present disclosure;
FIG. 4 is a flowchart illustrating a file format conversion method based on symbolic links according to yet another embodiment of the present disclosure;
FIG. 5 is a schematic diagram of a symbolic link-based file format conversion apparatus according to an embodiment of the present disclosure;
fig. 6 is a schematic diagram of an electronic device implementing a file format conversion method based on symbolic links according to an embodiment of the present disclosure.
Detailed Description
In order that the above objects, features and advantages of the present disclosure may be more clearly understood, aspects of the present disclosure will be further described below. It should be noted that, in the case of no conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure, but the present disclosure may be practiced in other ways than those described herein; it is to be understood that the embodiments disclosed in the specification are only a few embodiments of the present disclosure, and not all embodiments.
It is to be understood that, hereinafter, "at least one" means one or more, "a plurality" means two or more. "and/or" is used to describe the association relationship of the associated objects, meaning that there may be three relationships, for example, "a and/or B" may mean: only A, only B and both A and B are present, wherein A and B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of single item(s) or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
Fig. 1 is a flowchart of a file format conversion method based on symbolic links according to an embodiment of the present disclosure, where the file format conversion method may include the following steps:
step S101: and responding to the file format conversion task, establishing a symbolic link for the original file, wherein the symbolic link points to the original file and carries task attribute information of the file format conversion task.
Step S102: and acquiring task attribute information in the symbolic link.
Step S103: and carrying out format conversion on the original file based on the task attribute information to obtain a target file.
According to the file format conversion method based on the symbolic link, the symbolic link points to an original file to be converted, the symbolic link carries task attribute information of a file format conversion task, the process of describing and storing data format conversion task information can be simplified, file format conversion is achieved based on the symbolic link, the method is independent of a database and only needs support of a file system, time overhead and memory space overhead of accessing the database are not needed, the speed of directly reading and writing files pointed by the symbolic link and the symbolic link is higher, file format conversion can be achieved rapidly, file format conversion efficiency is high, and operation is simple and convenient. Meanwhile, file format conversion is realized based on symbolic links, and the method is independent of a specific operating system and a specific file system and can be used in a cross-platform mode. In addition, the symbolic link does not occupy a data area of a file system, and only occupies a directory area, so that the disk overhead is low. Overall, the scheme of the embodiment has the advantages of light weight, rapidness, cross-platform performance and the like.
The above steps will be described in detail below. In some examples, in response to the file format conversion task in step S101, a symbolic link is established for the original file, where the symbolic link points to the original file and carries task attribute information of the file format conversion task.
Illustratively, the original file may be a file in DOC, PDF, XML, JSON, etc., a file in multimedia format such as MP4, MOV, AVI, etc., a file in image format such as PNG, JPG, TIFF, etc., a file in three-dimensional model format such as OBJ,3DS, PLY, DAE, FBX, etc., and a file in CAD format such as DXF, DWG, etc. The identification of these format files can be based on, for example, a file Extension (Filename Extension), which is also referred to as a file suffix. The file format conversion task may indicate to convert a file in one format into a file in another format, i.e., a target file, such as converting a Word file in DOC format into a file in PDF format, but is not limited thereto. The task attribute information may include format information of the target file such as PDF format, parameter information at the time of conversion such as from which page of the Word file the conversion is started, and the like. For another example, the task attribute information when converting the multimedia format file may include format information of the target file, such as AVI format, output bitrate when converting, resolution of the converted video file, video width and height, and the like. The above is merely an example, and the task attribute information may be specifically set according to needs, which is not limited in this embodiment.
Symbolic links, also known as soft links, are a special class of files that contain a reference to other files or directories in the form of an absolute path or a relative path. Both Unix-like systems (including Linux, macOS) and Windows systems (e.g., windows Vista, windows 7 and later versions) support symbolic links, and higher level languages (C, C + +, go, etc.) also provide corresponding system calls or functional interfaces for creating, accessing, or deleting symbolic links. For example, the Go language creates symbolic links using an os.symlink function, that is, creates files pointing to other files, accesses the symbolic links using an os.readlink function to obtain the files pointed by the symbolic links, and the functions provided by the Go language can be used across platforms. The access operation to the symbolic link is redirected to the file pointed by the access operation, such as reading, writing, traversing and the like, but the copy, the move and the deletion of the symbolic link are directed to the symbolic link. Compared with shortcuts under Windows or records in a database, the symbolic link has smaller volume, can be supported by different modern operating systems, and has better cross-platform characteristic. In this embodiment, when the file format is converted, a corresponding symbolic link is established for the original file, and the symbolic link carries task attribute information of the file format conversion task.
Illustratively, if the original file contains two files, say xyz.obj and file.obj, then two symbolic links named To-.3ds-xyz.obj and To-.3ds-file.obj can be created. The task attribute information, i.e. To-.3ds, indicates that a format conversion operation is To be performed on the file.obj file, and the format of the converted target file is.3 ds.
It should be noted that the symbolic link name To-.3ds-xyz.obj can also have other forms by convention, not necessarily strictly following the format requirements given above. For example To-is not necessary and can be deleted, since the symbolic link is a special file pointing To the target file, which already contains the relative or absolute path of the target file, the file.obj in the symbolic link name is not necessary either, i.e. the symbolic link name corresponding To the file/foo/bar/file.obj can be 3ds completely, i.e. the target file format can be explicitly given by the symbolic link named 3ds by pointing To the file/foo/bar/file.obj, 3ds. In this embodiment, a simplified writing method of To-,. 3ds-file.obj is used instead of 3ds, so that a user can clearly and intuitively recognize that the file name of the original file pointed by the symbolic link named To-,. 3ds-file.obj is file, and the file extension, i.e., the file format, is.obj, that is, a format conversion operation is To be performed on the file.obj file, the converted target file format is.3 ds, and the converted target file name may be file.3ds or other names, but the extension should be.3 ds.
In step S102, task attribute information in the symbolic link is acquired.
For example, after the symbolic link is established, the original file file.obj To be converted and the task attribute information in the symbolic link, such as the task attribute information in the symbolic link named To-.3ds-file.obj, 3ds,
step S103: and carrying out format conversion on the original file based on the task attribute information to obtain a target file.
After 3ds, format conversion can be performed on the original file file.obj To obtain a target file.3ds. The obj file with the obj file format is the obj file, the obj performs the format conversion operation, and the converted target file format is the 3ds.
Optionally, in some embodiments of the present disclosure, the file format conversion task may include a batch conversion task, where the batch conversion task converts an instruction to perform format conversion on a plurality of original files. To improve the processing efficiency of format conversion, the organization, scheduling and management of format conversion operations is facilitated. Correspondingly, the step S101 of responding to the file format conversion task and establishing a symbolic link for the original file may specifically include the following steps:
step S201: responding to the batch conversion task, and creating a batch conversion catalog;
step S202: and respectively establishing corresponding symbolic links for the plurality of original files in the batch conversion directory, wherein each symbolic link points to the corresponding original file and carries task attribute information of a conversion task of the corresponding original file.
For example, in this implementation, the scheduling management program may be used to implement basic file organization and management, creation and management of a conversion task, and provision of one or more control functions of a command line, a right-click menu, a graphical interface, or a Web interface, which may be understood with reference to the prior art specifically and is not described herein again. The user can view and modify the file content and attributes such as authority and operation files (creating, copying, moving, deleting and the like) through the scheduling management program, initiate a file conversion or batch file conversion task to create symbolic links, delete the symbolic links corresponding to the file conversion tasks in batches or individually, and the like. Wherein, creating and managing conversion tasks (namely symbolic links) are the core functions of the scheduling management program, and general file (non-symbolic links) viewing, modifying or operating functions are optional.
Illustratively, when a user initiates a file conversion task such as a batch conversion task, a directory corresponding to the batch conversion task is created first, for example, the user creates the batch conversion task with the task name of T123456-TaskName, and the scheduling manager creates an exemplary directory/BgBatchTask/Pending/2020-10-10-T123456-TaskName/. Wherein 2020-10-10-T123456-TaskName represents the time and task name of task creation. the/BgBatchTask/directory is used for storing all batch conversion tasks, and the/BgBatchTask/Pending is used for storing original files to be converted.
In other embodiments, the scheduler manager may create the directory/BgBatchTask/Converted/2020-10-10-T123456-TaskName/and/BgBatchTask/Failed/, simultaneously. wherein,/BgBatchTask/Converted/directory is used for storing the Converted target file, and/BgBatchTask/Failed/directory is used for storing the file with the conversion failure.
If a user selects a plurality of files for batch conversion, such as three files of/foo/bar/abc.obj,/foo/bar/rst.obj and/foo/bar/xyz.obj, the scheduling management program can create three symbolic links in the created/BgBatchTask/Pending/2020-10-10-T123456-TaskName/directory, and To-, 3ds-abc.obj, to-, 3ds-rst.obj and To-, 3ds-xyz.obj point To the three files To be converted respectively.
Optionally, in some embodiments of the present disclosure, the plurality of original files include a first original file and a second original file located in a folder, so as to further improve the processing efficiency of format conversion, and facilitate organization, scheduling and management of format conversion operations. As shown in fig. 3, the method may further include the steps of:
step S301: creating a first subdirectory under the batch conversion directory, wherein the first subdirectory is used for storing a second original file;
step S302: establishing a corresponding symbolic link for a first original file in the batch conversion directory;
step S303: and establishing a corresponding symbolic link for the second original file in the first subdirectory.
Specifically, as an example, if the user selects a combination of files and folders, for example, the user selects two original files, i.e. two folders/foo/bar/abc/and/foo/bar/rst/two folders and/foo/bar/file.obj, the scheduler manager will create two symbolic links To 3ds-xyz.obj and To 3ds-file.obj in the/BgBatchTask/Pending/2020-10-10-T123456-taskanme/directory, and creating subdirectories/foo/bar/abc/and/foo/bar/rst/, respectively traversing the/foo/bar/abc/and/foo/bar/rst/two subdirectories, and respectively creating corresponding symbolic links for all files in the subdirectories, such as all files in the OBJ format, under the/BgBatchTask/Pending/2020-10-T123456-TaskName/directory.
Optionally, in some embodiments of the disclosure, the plurality of original files includes a third original file located in the same folder, and in order to further improve the processing efficiency of format conversion and facilitate organization, scheduling and management of format conversion operations, as shown in fig. 4, the method may further include the following steps:
step S401: and creating a second subdirectory under the batch conversion directory, wherein the second subdirectory is used for storing a third original file.
Step S402: and establishing a corresponding symbolic link for a third original file in the second subdirectory.
Specifically, as an example, if the user selects a folder, the scheduling manager may create a sub-directory and a symbolic link in the directory/BgBatchTask/Pending/2020-10-T123456-TaskName/for example, if the user selects/foo/bar/folder, create a bar/sub-directory in/BgBatchTask/Pending/2020-10-T123456-TaskName/traverse the files in the bar/sub-directory and create a corresponding symbolic link.
For example, if the conversion task is converted from the source format of the OBJ To the target format of the 3DS, the scheduler manager may traverse all OBJ files in/foo/bar/folder and create a corresponding symbolic link in/BgBatchTask/Pending/2020-10-T123456-taskanme/bar/such as raw file/foo/bar/file.obj corresponding To symbolic link/BgBatchTask/Pending/2020-10-T123456-taskanme/bar/To-. 3DS-file.obj, raw file/foo/bar/abc/xyz/xyz.obj corresponding To symbolic link/BgBatchTask/Pending/2020-10-T123456-taskanme/bar/top-. 3DS-xyz.obj.
For another example, if the user selects/foo/bar 1/,/foo/bar 2/and/foo/bar 3/three folders, then bar1/, bar 2/and bar 3/three subdirectories are created in directory/BgBatchTask/Pending/2020-10-T123456-TaskName/and bar1/, bar 2/and bar 3/three subdirectories are traversed respectively and corresponding symbolic links are created for files under each subdirectory.
Optionally, on the basis of the foregoing embodiments, in some embodiments of the present disclosure, the acquiring task attribute information in the symbolic link in step S102 specifically includes: traversing all symbolic links under each directory; and acquiring task attribute information of each symbolic link in all symbolic links.
Illustratively, for example, all symbolic links under directory/BgBatchTask/Pending/2020-10-10-T123456-TaskName/bar 1/, bar 2/and bar 3/three subdirectories may be traversed; traversing all symbolic links under the/BgBatchTask/Pending/2020-10-10-T123456-TaskName/bar/directory, and then acquiring task attribute information of each symbolic link in all the symbolic links.
Optionally, on the basis of the foregoing embodiments, in some embodiments of the present disclosure, the task attribute information may include, but is not limited to, file format information and a file format conversion parameter, where the file format information indicates a file format of a target file after converting an original file format.
For example, the name of the created symbolic link may carry task attribute information, such as parameter information added in the conversion process, and the symbolic link may be read during conversion to obtain the task attribute information and execute the conversion task.
A symbolic link, for example, named To-mp-4-W-H-BR-FR-OTHERS-file.avi or mp4-W-H-BR-FR-OTHERS-662F8D8, represents the conversion of a file.avi file To a file.mp4 file. Wherein To-mp 4 is file format information, that is, the file format of the converted target file is mp4, and W-H-BR-FR-OTHERS is a file format conversion parameter.
For example, W and H may represent the video width and height of the output, BR may represent the desired output bitrate, FR may represent the resolution of the output, and other optional parameters may or may not be agreed on by OTHERS. W, H, BR, FR may be a numeric value represented by a string or a numeric value with units, and OTHERS may be an agreed character-type parameter.
Correspondingly, in step S103, performing format conversion on the original file based on the task attribute information to obtain a target file, which may specifically include the following steps:
step i): and acquiring file format information and file format conversion parameters in the task attribute information.
Step ii): and calling a corresponding file format conversion tool based on the file format information.
Illustratively, the different file format information corresponds to different file format conversion tools, such as PDF format corresponding to PDF file format conversion tool.
Step iii): and the file format conversion tool performs format conversion on the original file based on the file format conversion parameter to obtain a corresponding target file.
Specifically, for example, the file format conversion tool may be, but is not limited to, a file format conversion program, which may be in an execution state or a suspended state, where the suspended state may wait for a start instruction issued by a user through, for example, a scheduling management program, or may be operated or stopped under specific conditions, such as a small system load, an idle period, and the like, according to a preset rule, and the file format conversion tool in the operating state may receive a stop instruction issued by the user through the scheduling management program, so as to stop the conversion process.
The file format conversion tool performing the conversion task may create multiple sub-processes for concurrently performing multiple conversion tasks. Taking a symbolic link such as directory/BgBatchTask/Pending/2020-10-T123456-symbolic name/bar/under symbolic link To, 3ds-file.obj, the background calls a specific file format conversion tool, such as conv _ command To perform a conversion task, the directory/foo/bar/under directory/3 ds-file.obj pointed by the symbolic link To is used as an input file, and parameter information (such as W-H-BR-FR-OTHERS or other agreed parameters) attached To the symbolic link name is also transmitted.
After the conversion operation is successfully executed, the corresponding symbolic link (3 ds or To-.3ds-file. Obj) can be deleted, and if the conversion task fails To be executed, the symbolic link/BgBatchTask/Pending/2020-10-10-T123456-TaskName/bar/To-. 3ds-file. Obj will be moved To the corresponding subdirectory/BgBatchTask/Failed/directory/BgBatchTask/Failed/2020-10-T123456-TaskName/bar/enont-3 ds-file. Obj. Wherein ENOENT-3ds-file.obj may have other file names, illustratively, the error code ENOENT indicates that the file pointed to by the symbolic link does not exist, which results in that the conversion cannot be performed, 3ds indicates the target file format, and file.obj indicates the original file name. In practice, there may be other types of errors, and the convention may be made as required, for example, there is insufficient disk space, an input file error, and the three-dimensional model lacks necessary material or texture files.
Optionally, on the basis of the foregoing embodiments, in some embodiments of the present disclosure, the method may further include: and creating a symbolic link name when each symbolic link is established, wherein each symbolic link name carries corresponding task attribute information, and each symbolic link in the same directory has different symbolic link names.
Illustratively, a symbolic link named To-3 ds-file. The task attribute information, i.e. To-.3ds therein, indicates that a format conversion operation is To be performed on the file.
In a file system, two files with the same name are not allowed to appear in the same directory. Therefore, in this embodiment, the naming method of To-.3ds-file.obj is used To help avoid file duplication, and if/foo/bar/file.obj is mapped To the symbolic link named 3ds, and/foo/bar/file.obj is also mapped To the symbolic link named 3ds, since two files named 3ds are not allowed To appear in the same directory/BgBatchTask/Pending/2020-10-10-T123456-tasame, it is more straightforward To use 3ds as the filename of the symbolic link, and To use two different filenames of To-.3ds-file.obj and To-. 3ds-file.obj. However, this is not essential, that is, the name of the symbolic link only satisfies the condition of convention by convention, for example, the condition that the name is not repeated in the same directory is satisfied, or the name is randomly named and not repeated, for example, in the form of 3ds-1 and 3ds-2, and of course, may be in the form of 3ds-B8a31B6 and 3 ds-4716317. If there is only one symbolic link under a directory, a name such as 3ds, that is, a target format is also feasible as a file name of the symbolic link. In this embodiment, the storage location of the created symbolic link is not limited, and may be located under an upper directory or under a lower sub-directory, as long as the names of the symbolic links under the same directory do not overlap.
The scheme provided by the embodiment of the disclosure can realize the creation, management, scheduling and organization of batch and massive file format conversion tasks. Compared with a mode of storing the format conversion task attributes and parameters in a database or other files, the scheme provided by the embodiment of the disclosure has the advantages of light weight, quickness, cross-platform and the like, and is embodied as follows:
1. because the database does not need to be accessed, the running time cost and the memory space cost are low, the conversion speed is high, the consumed time is less, and the efficiency is high.
2. The method is independent of a database, the attribute and the parameter of format conversion are stored in a directory area of a file system instead of the database, only the support of an operating system and the file system is needed, and the method is simple and convenient to implement and realizes light weight.
3. Independent of the specific operating system and file system, cross-platform usage is possible.
4. Independent of the particular high-level programming language, different language implementations may be used, such as C + +, go, and so on.
5. The operation is direct and convenient, in a single-machine program, a user can directly establish, check or delete the symbolic link in a file manager or a command, the operation is more convenient, the symbolic link is not required to be deleted by a scheduling management program, and if the symbolic link is a Web program, the operation can be carried out through a Web interface, so that the operation is more convenient;
6. the symbolic link does not occupy a data area of a file system, and only occupies a directory area, so that the disk overhead is low;
7. the method is independent of a database, has reliability, and can avoid problems caused by database faults;
8. the method and the system are flexibly deployed, and can be realized as a stand-alone program running on a stand-alone machine or a Web program running on a server.
It should be noted that although the steps of the methods of the present disclosure are depicted in the drawings in a particular order, this does not require or imply that the steps must be performed in this particular order or that all of the depicted steps must be performed to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions, etc. Additionally, it will also be readily appreciated that the steps may be performed synchronously or asynchronously, e.g., among multiple modules/processes/threads.
Based on the same concept, an embodiment of the present disclosure further provides a file format conversion apparatus based on symbolic link, as shown in fig. 5, the file format conversion apparatus based on symbolic link may include the following modules: the symbolic link establishing module 501 is configured to respond to a file format conversion task, establish a symbolic link for an original file, where the symbolic link points to the original file and carries task attribute information of the file format conversion task. An attribute information obtaining module 502, configured to obtain task attribute information of the symbol link. And a file format conversion module 503, configured to perform format conversion on the original file based on the task attribute information to obtain a target file.
Optionally, in some embodiments of the present disclosure, the file format conversion task includes a batch conversion task, and the batch conversion task performs format conversion on a plurality of original files. Correspondingly, the symbolic link establishing module 501 responds to the file format conversion task to establish a symbolic link for the original file, which may specifically include: responding to the batch conversion task, and creating a batch conversion catalog; and respectively establishing corresponding symbolic links for the plurality of original files in the batch conversion directory, wherein each symbolic link points to the corresponding original file and carries task attribute information of a conversion task of the corresponding original file.
Optionally, in some embodiments of the present disclosure, the plurality of original files includes a first original file and a second original file located in a folder, and the symbolic link establishing module 501 is further configured to: creating a first subdirectory under the batch conversion directory, wherein the first subdirectory is used for storing a second original file; establishing a corresponding symbolic link for a first original file in the batch conversion directory; and establishing a corresponding symbolic link for the second original file in the first subdirectory.
Optionally, in some embodiments of the present disclosure, the multiple original files include a third original file located in the same folder, and the symbolic link establishing module 501 is further configured to: creating a second subdirectory under the batch conversion directory, wherein the second subdirectory is used for storing a third original file; and establishing a corresponding symbolic link for a third original file in the second subdirectory.
Optionally, in some embodiments of the present disclosure, the obtaining of the task attribute information in the symbolic link by the attribute information obtaining module 502 specifically may include: traversing all symbolic links under each directory; and acquiring task attribute information of each symbolic link in all symbolic links.
Optionally, in some embodiments of the present disclosure, the task attribute information includes file format information and a file format conversion parameter, where the file format information indicates a file format of the target file after converting the original file format. Correspondingly, the file format conversion module 503 performs format conversion on the original file based on the task attribute information to obtain a target file, which may specifically include: acquiring file format information and file format conversion parameters in the task attribute information;
calling a corresponding file format conversion tool based on the file format information; and the file format conversion tool performs format conversion on the original file based on the file format conversion parameter to obtain a corresponding target file.
Optionally, in some embodiments of the present disclosure, the apparatus further includes a symbolic link name configuration module, configured to create a symbolic link name when each symbolic link is established, where each symbolic link name carries corresponding task attribute information, and each symbolic link in the same directory has a different symbolic link name.
The detailed description of the apparatus in the above embodiments, the specific manner in which each module performs operations, and the corresponding technical effects, have been described in the embodiments related to the method, and will not be described in detail herein.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units. The components shown as modules or units may or may not be physical units, i.e. may be located in one place or may also be distributed over a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the wood-disclosed scheme. One of ordinary skill in the art can understand and implement it without inventive effort.
The disclosed embodiments also provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the file format conversion method based on symbolic link according to any one of the above embodiments.
By way of example, and not limitation, such readable storage media can be an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable storage medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable storage medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
The embodiment of the disclosure also provides an electronic device, which includes a processor and a memory, wherein the memory is used for storing the executable instruction of the processor. Wherein the processor is configured to perform the steps of the symbolic link based file format conversion method of any of the above embodiments via execution of the executable instructions.
For example, the electronic device may be a computer, or a server cluster, which is not limited in this embodiment.
An electronic device 600 according to an embodiment of the invention is described below with reference to fig. 6. The electronic device 600 shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 6, the electronic device 600 is embodied in the form of a general purpose computing device. The components of the electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 that connects the various system components (including the storage unit 620 and the processing unit 610), a display unit 640, and the like.
Wherein the storage unit stores program code that can be executed by the processing unit 610, so that the processing unit 610 executes the steps according to various exemplary embodiments of the present invention described in the symbolic link-based file format conversion method section described above in this specification. For example, the processing unit 610 may perform the steps of the symbol link-based file format conversion method as shown in fig. 1.
The storage unit 620 may include readable media in the form of volatile memory units, such as a random access memory unit (RAM) 6201 and/or a cache memory unit 6202, and may further include a read-only memory unit (ROM) 6203.
The memory unit 620 may also include programs/utilities 6204 having a set (at least one) of program modules 6205, such program modules 6205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 630 may be one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 600 may also communicate with one or more external devices 700 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 600, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 600 to communicate with one or more other computing devices. Such communication may occur via an input/output (I/O) interface 650. Also, the electronic device 600 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the Internet) via the network adapter 660. The network adapter 660 may communicate with the other modules of the electronic device 600 via the bus 630. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, or a network device, etc.) to execute the above file format conversion method based on symbolic links according to the embodiments of the present disclosure.
It is noted that, in this document, relational terms such as "first" and "second," and the like, are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
The previous description is only for the purpose of describing particular embodiments of the present disclosure, so as to enable those skilled in the art to understand or implement the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the disclosure. Thus, the present disclosure is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (9)

1. A file format conversion method based on symbolic link is characterized by comprising the following steps:
responding to a file format conversion task, establishing a symbolic link for an original file, wherein the symbolic link points to the original file and carries task attribute information of the file format conversion task;
acquiring task attribute information in the symbolic link;
performing format conversion on the original file based on the task attribute information to obtain a target file;
the file format conversion task comprises a batch conversion task, and the batch conversion task indicates format conversion of a plurality of original files;
the task of converting the format of the response file establishes symbolic link for the original file, and comprises the following steps:
responding to the batch conversion task, and creating a batch conversion catalog;
and respectively establishing corresponding symbolic links for the plurality of original files in the batch conversion directory, wherein each symbolic link points to the corresponding original file and carries task attribute information of a conversion task of the corresponding original file.
2. The file format conversion method according to claim 1, wherein the plurality of original files include a first original file and a second original file located in a folder, the method further comprising:
creating a first subdirectory under the batch conversion directory, wherein the first subdirectory is used for storing a second original file;
establishing a corresponding symbolic link for a first original file in the batch conversion directory;
and establishing a corresponding symbolic link for the second original file in the first subdirectory.
3. The file format conversion method according to claim 1, wherein the plurality of original files include a third original file located in the same folder, the method further comprising:
creating a second subdirectory under the batch conversion directory, wherein the second subdirectory is used for storing a third original file;
and establishing a corresponding symbolic link for a third original file in the second subdirectory.
4. The file format conversion method according to any one of claims 1 to 3, wherein the acquiring task attribute information in the symbolic link includes:
traversing all symbolic links under each directory;
and acquiring task attribute information of each symbolic link in all symbolic links.
5. The file format conversion method according to claim 4, wherein the job attribute information includes file format information indicating a file format of the target file after conversion of the original file format and a file format conversion parameter;
the converting the format of the original file based on the task attribute information to obtain a target file comprises:
acquiring file format information and file format conversion parameters in the task attribute information;
calling a corresponding file format conversion tool based on the file format information;
and the file format conversion tool performs format conversion on the original file based on the file format conversion parameter to obtain a corresponding target file.
6. The file format conversion method according to claim 4, characterized in that the method further comprises:
and creating a symbolic link name when each symbolic link is established, wherein each symbolic link name carries corresponding task attribute information, and each symbolic link in the same directory has different symbolic link names.
7. A file format conversion apparatus based on symbolic link, comprising:
the symbolic link establishing module is used for responding to a file format conversion task and establishing a symbolic link for an original file, wherein the symbolic link points to the original file and carries task attribute information of the file format conversion task;
the attribute information acquisition module is used for acquiring task attribute information of the symbolic link;
the file format conversion module is used for carrying out format conversion on the original file based on the task attribute information to obtain a target file;
the file format conversion task comprises a batch conversion task, and the batch conversion task indicates format conversion of a plurality of original files;
the symbolic link establishing module is specifically used for responding to the batch conversion tasks and establishing a batch conversion catalog; and respectively establishing corresponding symbolic links for the plurality of original files in the batch conversion directory, wherein each symbolic link points to the corresponding original file and carries task attribute information of a conversion task of the corresponding original file.
8. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the symbolic link-based file format conversion method according to any one of claims 1 to 6.
9. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the steps of the symbolic link based file format conversion method of any of claims 1-6 via execution of the executable instructions.
CN202011299712.XA 2020-11-18 2020-11-18 File format conversion method, device, medium and equipment based on symbolic link Active CN112269761B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011299712.XA CN112269761B (en) 2020-11-18 2020-11-18 File format conversion method, device, medium and equipment based on symbolic link

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011299712.XA CN112269761B (en) 2020-11-18 2020-11-18 File format conversion method, device, medium and equipment based on symbolic link

Publications (2)

Publication Number Publication Date
CN112269761A CN112269761A (en) 2021-01-26
CN112269761B true CN112269761B (en) 2023-04-07

Family

ID=74340288

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011299712.XA Active CN112269761B (en) 2020-11-18 2020-11-18 File format conversion method, device, medium and equipment based on symbolic link

Country Status (1)

Country Link
CN (1) CN112269761B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114741082A (en) * 2022-04-21 2022-07-12 光大科技有限公司 Yaml file conversion method and device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7185030B2 (en) * 2004-03-18 2007-02-27 Hitachi, Ltd. Storage system storing a file with multiple different formats and method thereof
CN102609400B (en) * 2011-01-19 2015-01-14 上海中信信息发展股份有限公司 Method for converting file formats and conversion tool
US20180039652A1 (en) * 2016-08-02 2018-02-08 Microsoft Technology Licensing, Llc Symbolic link based placeholders
CN108108478B (en) * 2018-01-04 2020-05-05 中煤航测遥感集团有限公司 Data format conversion method and system and electronic equipment
CN109522284A (en) * 2018-11-26 2019-03-26 天津渤化工程有限公司 Files in batch conversion method and device

Also Published As

Publication number Publication date
CN112269761A (en) 2021-01-26

Similar Documents

Publication Publication Date Title
US8316065B2 (en) Data migration system and data migration method
US20170177452A1 (en) Computing device replication using file system change detection methods and systems
US20210297495A1 (en) Automatic discovery and registration of service applications for files introduced to a user interface
JP6140145B2 (en) Tenant data recovery across tenant migration
CN100514331C (en) Method of converting a filesystem while the filesystem remains in an active state
CN101523358A (en) Fast and reliable synchronization of file system directories
US10572546B2 (en) Information processing apparatus, document display method, document display system, and medium
US8767253B2 (en) Information processing apparatus and computer program product
CN110908671A (en) Method and device for constructing docker mirror image and computer readable storage medium
US20200326872A1 (en) Data co-location in a hierarchical storage management (hsm) system
CN112269761B (en) File format conversion method, device, medium and equipment based on symbolic link
US20230101774A1 (en) Techniques for performing clipboard-to-file paste operations
JP2015205499A (en) Image processing device, control method and program of image processing device
CN110119386B (en) Data processing method, data processing apparatus, medium, and computing device
KR101156227B1 (en) File processing device for executing preprocessed file and recording medium for executing preprocessed file
KR101512296B1 (en) File associated with application processing terminal and processing method of file associated with application
JP6131648B2 (en) DATA MANAGEMENT SYSTEM, INFORMATION SYSTEM, DATA MANAGEMENT METHOD, INFORMATION SYSTEM CONTROL METHOD, PROGRAM FOR THE METHOD, AND RECORDING MEDIUM CONTAINING THE PROGRAM
TWI571754B (en) Method for performing file synchronization control, and associated apparatus
CN115586872A (en) Container mirror image management method, device, equipment and storage medium
CN109918346A (en) A kind of creation method and device of file
US10747748B2 (en) Generating mobile data schema to support disconnected operations
CN113672334A (en) Container management method and device
CN109358972B (en) Log management method and device of middleware client and computer system
US9626389B1 (en) Data compression model for mobile device disconnected operations
CN117648198B (en) Application adaptation method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant