CN112711562B - File migration method and device, electronic equipment and storage medium - Google Patents

File migration method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112711562B
CN112711562B CN202011634800.0A CN202011634800A CN112711562B CN 112711562 B CN112711562 B CN 112711562B CN 202011634800 A CN202011634800 A CN 202011634800A CN 112711562 B CN112711562 B CN 112711562B
Authority
CN
China
Prior art keywords
file
path
migrated
migration
directory
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
CN202011634800.0A
Other languages
Chinese (zh)
Other versions
CN112711562A (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.)
Zhuhai Baoqu Technology Co Ltd
Original Assignee
Zhuhai Baoqu Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuhai Baoqu Technology Co Ltd filed Critical Zhuhai Baoqu Technology Co Ltd
Priority to CN202011634800.0A priority Critical patent/CN112711562B/en
Publication of CN112711562A publication Critical patent/CN112711562A/en
Application granted granted Critical
Publication of CN112711562B publication Critical patent/CN112711562B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/119Details of migration of file systems
    • 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/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems

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)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a migration method, a migration device, electronic equipment and a storage medium of files, wherein the method comprises the following steps: acquiring a file to be migrated; if the file to be migrated is in a state occupied by the process, acquiring a first path of the process occupying the file to be migrated; if the first path is matched with the second path of any process in the white list process catalog, the occupation of the process corresponding to the first path on the files to be migrated is relieved; and migrating the file to be migrated to a target migration position. The method determines whether to remove the occupation of the process occupying the file to be migrated by utilizing the white list process catalog, thereby improving the migration success rate of the file and the success rate of ending the occupation.

Description

File migration method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and apparatus for migration of a file, an electronic device, and a storage medium.
Background
Along with the increasing functions of electronic devices, files stored on the electronic devices are increased, and more files of a certain disk can appear, so that the running speed of the devices is slower. To solve this problem, the file may be migrated, but when the file is migrated, it often happens that the file is occupied by other processes or software, so that the file migration fails.
How to improve the migration success rate and the end occupation success rate of the file is a problem to be solved urgently.
Disclosure of Invention
The application provides a file migration method, a file migration device, electronic equipment and a storage medium.
In one aspect, an embodiment of the present application provides a method for migrating a file, including:
acquiring a file to be migrated;
if the file to be migrated is in a state occupied by a process, acquiring a first path of the process occupying the file to be migrated;
if the first path is matched with a second path of any process in the white list process directory, eliminating occupation of the process corresponding to the first path on the file to be migrated;
and migrating the file to be migrated to a target migration position.
According to the file migration method, the file to be migrated is obtained, if the file to be migrated is in the state occupied by the process, the path of the process occupying the file to be migrated is obtained, if the path of the process occupying the file to be migrated is matched with the path of any process in the white list process catalog, the occupation can be relieved, and the file to be migrated is migrated to the target migration position. Therefore, whether the process occupying the file to be migrated is unoccupied or not is determined by utilizing the white list process directory, so that the success rate of file migration and the success rate of ending the occupation are improved.
In one possible implementation manner of an embodiment of an aspect of the present application, the matching of the first path with the second path of any process in the white list process directory includes:
each field in the first path is sequentially matched with each field in the second path;
or,
the specified field in the first path matches the specified field in the second path.
In one possible implementation manner of an embodiment of an aspect of the present application, after the obtaining the first path of the process occupying the file to be migrated, the method further includes:
and if the first path is matched with the third path of any process in the blacklist process catalog, returning a prompt message of failure in migration of the file to be migrated.
In one possible implementation manner of an embodiment of an aspect of the present application, after the obtaining the first path of the process occupying the file to be migrated, the method further includes:
and if the first path is not matched with the paths of all the processes in the white list process directory and the black list process directory, sending the first path and the identification of the file to be migrated to a server.
In one possible implementation manner of an embodiment of an aspect of the present application, after the sending the identifier of the first path and the file to be migrated to the server, the method further includes:
if the updated white list process catalog returned by the server is obtained, detecting a matching state between the first path and paths of all processes in the updated white list process catalog;
if the first path is matched with a fourth path of any process in the updated white list process directory, eliminating occupation of the process corresponding to the first path on the file to be migrated;
and migrating the file to be migrated to a target migration position.
In one possible implementation manner of an embodiment of an aspect of the present application, the file to be migrated is an associated file of any application, and after the migration of the file to be migrated to the target migration location, the method further includes:
and updating the call address of the associated file in any application according to the target migration position.
In another aspect, an embodiment of the present application provides a migration apparatus for a file, including:
the first acquisition module is used for acquiring files to be migrated;
the second acquisition module is used for acquiring a first path of a process occupying the file to be migrated when the file to be migrated is in a state occupied by the process;
the releasing module is used for releasing the occupation of the process corresponding to the first path on the file to be migrated when the first path is matched with the second path of any process in the white list process catalog;
and the migration module is used for migrating the file to be migrated to a target migration position.
According to the file migration device, the file to be migrated is obtained, if the file to be migrated is in the state occupied by the process, the path of the process occupying the file to be migrated is obtained, and if the path of the process occupying the file to be migrated is matched with the path of any process in the white list process catalog, the occupation can be relieved, and the file to be migrated is migrated to the target migration position. Therefore, whether the process occupying the file to be migrated is unoccupied or not is determined by utilizing the white list process directory, so that the success rate of file migration and the success rate of ending the occupation are improved.
In a possible implementation manner of another aspect of the present application, the matching of the first path with the second path of any process in the white list process directory includes:
each field in the first path is sequentially matched with each field in the second path;
or,
the specified field in the first path matches the specified field in the second path.
In a possible implementation manner of another aspect of the present application, the apparatus may further include:
and the return module is used for returning the prompt message of the migration failure of the file to be migrated when the first path is matched with the third path of any process in the blacklist process catalog.
In a possible implementation manner of another aspect of the present application, the apparatus further includes:
and the sending module is used for sending the first path and the identification of the file to be migrated to a server when the first path is not matched with the paths of all the processes in the white list process directory and the black list process directory.
In a possible implementation manner of another aspect of the present application, the apparatus may further include:
the detection module is used for detecting the matching state between the first path and the paths of all the processes in the updated white list process directory if the updated white list process directory returned by the server is acquired;
the releasing module is further configured to release, when the first path is matched with a fourth path of any process in the updated whitelist process directory, occupation of the process corresponding to the first path on the file to be migrated;
and the migration module is used for migrating the file to be migrated to a target migration position.
In a possible implementation manner of another aspect of the embodiment of the present application, the file to be migrated is an association file of any application, and the apparatus may further include:
and the updating module is used for updating the call address of the associated file in any application according to the target migration position.
Another embodiment of the present application proposes an electronic device, including: a processor and a memory;
the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to implement the file migration method according to the embodiment of the aspect.
Another embodiment of the present application proposes a non-transitory computer readable storage medium, on which a computer program is stored, which when executed by a processor implements a method for migration of files according to the embodiment of the above aspect.
Another embodiment of the present application proposes a computer program product comprising a computer program which, when executed by a processor, implements a method for migration of files as described in the embodiment of the above aspect.
Additional aspects and advantages of the application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the application.
Drawings
The foregoing and/or additional aspects and advantages of the present application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings, in which:
fig. 1 is a flow chart of a migration method of a file according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating another method for migrating a file according to an embodiment of the present disclosure;
FIG. 3 is a flowchart illustrating another method for migrating a file according to an embodiment of the present disclosure;
FIG. 4 is a flowchart illustrating another method for migrating a file according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a file migration device according to an embodiment of the present application.
Detailed Description
Embodiments of the present application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the drawings are exemplary and intended for the purpose of explaining the present application and are not to be construed as limiting the present application.
The following describes a migration method, a migration device, an electronic device and a storage medium of a file according to an embodiment of the present application with reference to the accompanying drawings.
In practical application, when the file is migrated, the situation that the file is occupied by other processes or software often occurs, so that the file migration fails. In view of the problem, the embodiment of the application provides a file migration method.
Fig. 1 is a flow chart of a migration method of a file according to an embodiment of the present application.
The file migration method of the embodiment of the application can be executed by the file migration device of the embodiment of the application, and the device can be configured in the electronic equipment to determine whether to release occupation of the process occupying the file to be migrated to the file to be migrated by utilizing the white list process catalog, so that the migration success rate of the file and the success rate of ending occupation are improved.
As shown in fig. 1, the migration method of the file includes:
and step 101, acquiring a file to be migrated.
In the application, the electronic device may display a file migration interface, and when a user wants to migrate a file under a certain directory to other positions of the electronic device, the user may select a file to be migrated, a target migration position, a white list process directory, and the like on the file migration interface of the electronic device, so that the electronic device may obtain a file migration request.
The file migration request may include a target migration location, a file to be migrated, a white list process directory, and the like, and the electronic device may obtain the file to be migrated, the target migration location, the white list process directory, and the like by analyzing the file migration request. In the application, the target migration position is a position to which the file to be migrated is to be moved, namely a new storage position of the file to be migrated; the white list process directory may include processes that may be unoccupied when the files to be migrated are occupied, e.g., may include information such as a process identifier, a path of the process, and the like.
Optionally, the user may migrate all files under the file directory, that is, migrate the file directory to the target migration location, where all files under the file directory to be migrated are files to be migrated. The file directory to be migrated may include at least one file to be migrated. When a user migrates a file directory, the electronic device can acquire the file directory to be migrated, a white list process directory and the like, wherein the white list process directory can comprise a process which can be relieved when occupying the file to be migrated under the target of the file to be migrated.
In the application, different files or file directories to be migrated can correspond to different white list process directories.
Optionally, a correspondence between the file or the file directory and the white list process directory may be preconfigured, and when the electronic device obtains the file to be migrated or the file directory to be migrated, the electronic device may read the configuration data to obtain the white list process directory corresponding to the file to be migrated or the file directory to be migrated.
Step 102, if the file to be migrated is in the state occupied by the process, acquiring a first path of the process occupying the file to be migrated.
After the file to be migrated is obtained, whether the file to be migrated is currently in a state occupied by a process is determined. If the file to be migrated is in the state of being occupied by the process, the path of the process currently occupying the file to be migrated, that is, the address of the process, is referred to herein as the first path for convenience of distinction.
If the user migrates the file catalogue, the electronic device may traverse the file catalogue of the file to be migrated after obtaining the file catalogue to be migrated, and determine whether each file to be migrated in the file catalogue to be migrated is currently in a state occupied by a process. And under the condition that any file to be migrated in the file catalog to be migrated is in a state occupied by the process, acquiring a first path of the process currently occupying any file to be migrated.
Step 103, if the first path is matched with the second path of any process in the white list process directory, the process corresponding to the first path is relieved from occupying the file to be migrated.
After the first path is obtained, the first path may be matched with a path of a process in the whitelist process directory, for example, the first path may be compared with a path of a process in the whitelist process directory to determine whether the first path is matched with a path of any process in the whitelist process directory.
If the first path is matched with the second path of any process in the white list process catalog, the occupation of the process corresponding to the first path on the files to be migrated can be relieved by ending the process corresponding to the first path.
And 104, migrating the file to be migrated to a target migration position.
After the occupation of the files to be migrated by the process corresponding to the first path is relieved, the files to be migrated can be migrated to the target migration position. The target migration position is a new storage position of the file to be migrated.
In the application, when the file to be migrated is occupied, the path of the process occupying the file to be migrated can be matched with the path of the process in the white list process directory. If the path of the process occupying the file to be migrated is matched with the path of any process in the white list process directory, the process occupying the file to be migrated can be relieved from occupying the file to be migrated, so that the file to be migrated is migrated to the target migration position.
According to the file migration method, the file to be migrated is obtained, if the file to be migrated is in the state occupied by the process, the path of the process occupying the file to be migrated is obtained, if the path of the process occupying the file to be migrated is matched with the path of any process in the white list process catalog, the occupation can be relieved, and the file to be migrated is migrated to the target migration position. Therefore, whether the process occupying the file to be migrated is unoccupied or not is determined by utilizing the white list process directory, so that the success rate of file migration and the success rate of ending the occupation are improved.
In one embodiment of the present application, when determining whether the first path matches a path of any process in the whitelist process directory, each field in the first path may be sequentially matched with each field in a path of a process in the whitelist process directory. If each field in the first path is sequentially matched with each field in the second path of any process in the white list process catalog, the first path and the second path are the same, and the first path and the second path can be considered to be matched.
Or, the specified field in the first path may be matched with the specified field in the path of the process in the white list process directory, and if the specified field in the first path is matched with the specified field in the second path of any process in the white list process directory, the first path may be considered to be matched with the second path of any process in the white list process directory. Therefore, the occupation of the process corresponding to the first path to the file to be migrated can be relieved by comparing the partial fields in the first path with the partial fields in the second path when the partial fields in the first path are matched with the partial fields in the second path.
In specific implementation, a preset number of fields in the path of the process may be used as the specified fields. For example, the first path is "d: the first three fields" d "," d1"," d2 "in the path of the process may be compared with the first 3 fields of the path of the process in the whitelist process directory, respectively. If the first 3 fields of the first path are consistent with the first 3 fields of the second path of any process in the white list process directory, the first path may be considered to match the second path.
In order to avoid ending non-ending processes during migration of files, in one embodiment of the present application, a blacklist process directory solution may be utilized. Fig. 2 is a schematic flow chart of another file migration method according to an embodiment of the present application.
As shown in fig. 2, the migration method of the file includes:
step 201, obtaining a file to be migrated.
In the application, when a user performs a file migration operation on a file migration interface of an electronic device, a file migration request acquired by the electronic device may include a target migration position, a file to be migrated, a white list process directory, a black list process directory, and the like. The blacklist process directory may include a process that does not need to be unoccupied when the file to be migrated is occupied, for example, may include a process identifier, a path of the process, a process name, and other information.
Step 202, if the file to be migrated is in the state occupied by the process, acquiring a first path of the process occupying the file to be migrated.
In this application, step 202 is similar to step 102 described above, and reference is made to the above embodiments, so that the description is omitted here.
Step 203, if the first path is matched with the third path of any process in the blacklist process directory, a prompt message of failure in migration of the file to be migrated is returned.
After the first path of the process occupying the file to be migrated is obtained, the first path may be matched with the path of the process in the blacklist process directory. For example, when each field in the first path matches each field in the third path of any process in the blacklist process directory in turn, or a specified field in the first path matches a specified field in the third path of any process, the first path may be considered to match the third path of any process in the blacklist process directory.
And under the condition that the first path is matched with the third path of any process in the blacklist process catalog, the fact that the file to be migrated cannot be migrated, namely the file to be migrated fails in migration is indicated, and a prompt message of the file to be migrated fails in migration can be returned. The prompt message may include an identifier of a file to be migrated, a reason for migration failure, information of a process corresponding to the third path, and the like. Therefore, the user can know which files are failed to migrate, the reasons of the failed migration and the like through the prompt message.
If the paths of the processes in the first path and the blacklist process directory are not matched, the paths of the processes in the first path and the blacklist process directory can be matched. Under the condition that the first path is matched with the path of any process in the white list process catalog, the occupation of the process corresponding to the first path to the file to be migrated is relieved, and the file to be migrated is migrated to the target migration position.
According to the file migration method, after the first path of the process occupying the file to be migrated is obtained, a prompt message of failure in migration of the file to be migrated can be returned under the condition that the first path is matched with the third path of any process in the blacklist process catalog. Therefore, whether the migration failure of the files to be migrated occupied by other processes is determined by utilizing the blacklist process catalog, and when the path of the process occupying the files to be migrated is matched with the path of any process in the blacklist process catalog, the migration failure is determined and a migration failure message is returned, so that not only ending of the processes which cannot be ended can be avoided, but also the user can be informed of the file migration failure message in time.
Fig. 3 is a flow chart of another migration method of a file according to an embodiment of the present application.
As shown in fig. 3, the migration method of the file includes:
step 301, obtaining a file to be migrated.
Step 302, if the file to be migrated is in the state occupied by the process, a first path of the process occupying the file to be migrated is obtained.
In this embodiment, steps 301 to 302 are similar to the above embodiments, and thus are not repeated here.
Step 303, if the first path is not matched with the paths of each process in the white list process directory and the black list process directory, the first path and the identification of the file to be migrated are sent to the server.
In the application, the first path may be respectively matched with the path of the process in the white list process directory and the path of the process in the black list process directory. The matching method can be referred to the above embodiments, and thus will not be described herein.
Under the condition that the first path is not matched with paths of all processes in the white list process directory and the black list process directory, whether the process corresponding to the first path can be relieved from occupying the files to be migrated or not cannot be determined, and the first path and the identification of the files to be migrated can be sent to a server, so that the server judges whether the occupation can be relieved or not according to the obtained first path and the identification of the files to be migrated. The identifier of the file may be the name of the file, or may be other identifiers that may identify the uniqueness of the file.
According to the file migration method, after the first path of the process occupying the file to be migrated is obtained, the first path and the identification of the file to be migrated can be sent to the server under the condition that the first path is not matched with the paths of all the processes in the white list process directory and the black list process directory. Therefore, when the white list process catalog and the black list process catalog are utilized, whether the occupation of other processes to the files to be migrated cannot be removed can not be determined, the server can be utilized to determine, and therefore the migration success rate and the end occupation success rate of the files are improved.
Fig. 4 is a flowchart of another migration method of a file according to an embodiment of the present application.
As shown in fig. 4, the migration method of the file includes:
step 401, obtaining a file to be migrated.
Step 402, if the file to be migrated is in the state occupied by the process, obtaining a first path of the process occupying the file to be migrated.
In this application, steps 401 to 402 are similar to the above embodiments, and thus are not repeated here.
Step 403, if the first path is not matched with the paths of each process in the white list process directory and the black list process directory, sending the first path and the identification of the file to be migrated to the server.
In this application, step 403 is similar to step 303, and thus will not be described herein.
Step 404, if the updated white list process directory returned by the server is obtained, detecting a matching state between the first path and paths of each process in the updated white list process directory.
In the application, after the server obtains the first path and the identifier of the file to be migrated, whether the process corresponding to the first path is released from occupation of the file to be migrated can be determined through analysis. If the server determines that the process corresponding to the first path can be released from occupying the file to be migrated, other information of the process corresponding to the first path and the first path, such as a process identifier, a process name and the like, can be added into the white list process directory, and the updated white list process directory is returned to the electronic device.
Optionally, the server may further determine other processes that may be unoccupied according to the identifier of the file to be migrated, and add the determined other processes to the whitelist process directory.
Under the condition that the electronic device obtains the updated white list process catalog returned by the server, the matching state between the first path and the paths of each process in the updated white list process catalog can be detected, and the detection method can be referred to the above embodiments and is not repeated herein.
Step 405, if the first path is matched with the fourth path of any process in the updated white list process directory, removing the occupation of the process corresponding to the first path to the file to be migrated.
Under the condition that the first path is matched with the fourth path of any process in the updated white list process catalog, the occupation of the process corresponding to the first path on the files to be migrated can be relieved by ending the process corresponding to the first path.
Optionally, if the server determines that the process corresponding to the first path can be released from occupation of the file to be migrated, a message that the process can be released from occupation can also be sent to the electronic device. After the electronic device obtains the unoccupied message returned by the server, the electronic device can remove the occupation of the process corresponding to the first path to the file to be migrated by ending the process corresponding to the first path, and add the first path to the white list process directory to update the white list process directory.
And step 406, migrating the file to be migrated to the target migration position.
After the occupation of the files to be migrated by the process corresponding to the first path is relieved, the files to be migrated can be migrated to the target migration position.
It can be understood that after the server obtains the first path and the identifier of the file to be migrated, if it is determined that the process corresponding to the first path cannot be released from the occupation of the file to be migrated, the process corresponding to the first path may be added to the blacklist process directory to update the blacklist process directory, and the updated blacklist process directory is sent to the electronic device. Under the condition that the electronic equipment acquires the updated blacklist process catalog returned by the server, whether the migration of the file to be migrated fails or not can be determined by utilizing the updated blacklist process catalog.
Optionally, the server may also send information of the process corresponding to the first path to the electronic device, and after the electronic device obtains the information of the process corresponding to the first path, the electronic device may return a prompt message that the migration of the file to be migrated fails, and update the process corresponding to the first path to the blacklist process directory.
According to the file migration method, after the first path and the identification of the file to be migrated are sent to the server, whether the process corresponding to the first path can be relieved from occupying the file to be migrated or not can be determined by utilizing the updated white list process catalog under the condition that the updated white list process catalog returned by the server is obtained, so that the migration success rate and the success rate of ending occupying the file are improved.
In practical applications, when the space of a disk (such as a C disk) is full, the system operation is slow, and some operations cannot be performed normally. Based on this, in one embodiment of the present application, the application may be migrated to another location, where the migration essence of the application is also migration of the file, and if the file to be migrated in the state occupied by the process is an associated file of any application, after the file to be migrated is migrated to the target migration location, the call address of the associated file in any application may be updated according to the target migration location.
The calling address of the associated file is the storage position of the associated file. It can be understood that the call address of the associated file is updated to the target migration location from the location before the migration of the file to be migrated. That is, the storage location of the file to be migrated is updated to the target migration location. When the application runs and the file to be migrated is called, the file to be migrated is called according to the calling address.
In the file migration method, if the file to be migrated is an associated file of any application, after the file to be migrated is migrated to the target migration position, the call address of the associated file in any application can be updated according to the target migration position. Therefore, when the application is migrated, the call address of the associated file of the application can be updated according to the migrated position after the associated file of the application is migrated to other positions, so that the associated file is called according to the updated call address when the application runs, and normal use of the application is ensured.
In order to achieve the above embodiments, the embodiments of the present application further provide a migration device for files. Fig. 5 is a schematic structural diagram of a file migration device according to an embodiment of the present application.
As shown in fig. 5, the migration apparatus 500 of the file includes: a first acquisition module 510, a second acquisition module 520, a release module 530, and a migration module 540.
A first obtaining module 510, configured to obtain a file to be migrated;
the second obtaining module 520 is configured to obtain a first path of a process occupying the file to be migrated when the file to be migrated is in a state occupied by the process;
a releasing module 530, configured to release, when the first path is matched with the second path of any process in the white list process directory, occupation of the process corresponding to the first path to the file to be migrated;
the migration module 540 is configured to migrate the file to be migrated to the target migration location.
In one possible implementation manner of the embodiment of the present application, the matching of the first path with the second path of any process in the white list process directory includes:
each field in the first path is sequentially matched with each field in the second path;
or,
the specified field in the first path matches the specified field in the second path.
In one possible implementation manner of the embodiment of the application, the apparatus may further include:
and the return module is used for returning a prompt message of failure in migration of the file to be migrated when the first path is matched with the third path of any process in the blacklist process catalog.
In one possible implementation manner of the embodiment of the application, the apparatus may further include:
and the sending module is used for sending the first path and the identification of the file to be migrated to the server when the first path is not matched with the paths of all the processes in the white list process directory and the black list process directory.
In one possible implementation manner of the embodiment of the application, the apparatus may further include:
the detection module is used for detecting the matching state between the first path and the paths of each process in the updated white list process directory when the updated white list process directory returned by the server is acquired;
the releasing module 530 is further configured to release, when the first path is matched with the fourth path of any process in the updated white list process directory, the process corresponding to the first path from occupying the file to be migrated;
the migration module 540 is configured to migrate the file to be migrated to the target migration location.
In one possible implementation manner of the embodiment of the present application, the file to be migrated is an association file of any application, and the apparatus may further include:
and the updating module is used for updating the calling address of the associated file in any application according to the target migration position.
It should be noted that the foregoing explanation of the embodiment of the file migration method is also applicable to the file migration device of this embodiment, so that the description is omitted here.
According to the file migration device, the file to be migrated is obtained, if the file to be migrated is in the state occupied by the process, the path of the process occupying the file to be migrated is obtained, and if the path of the process occupying the file to be migrated is matched with the path of any process in the white list process catalog, the occupation can be relieved, and the file to be migrated is migrated to the target migration position. Therefore, whether the process occupying the file to be migrated is unoccupied or not is determined by utilizing the white list process directory, so that the success rate of file migration and the success rate of ending the occupation are improved.
In order to achieve the foregoing embodiments, an embodiment of the present application further provides an electronic device, including: including a processor and a memory;
wherein the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, for implementing the migration method of the file as described in the above embodiment.
In order to implement the above embodiments, the embodiments of the present application also provide a non-transitory computer-readable storage medium having stored thereon a computer program that, when executed by a processor, implements the migration method of files as described in the above embodiments.
In order to implement the above embodiments, the embodiments of the present application also propose a computer program product comprising a computer program which, when executed by a processor, implements a migration method of a file as described in the above embodiments.
In the description of this specification, the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In the description of the present application, the meaning of "plurality" is at least two, such as two, three, etc., unless explicitly defined otherwise.
Although embodiments of the present application have been shown and described above, it will be understood that the above embodiments are illustrative and not to be construed as limiting the application, and that variations, modifications, alternatives, and variations may be made to the above embodiments by one of ordinary skill in the art within the scope of the application.

Claims (15)

1. A method for migrating a file, comprising:
acquiring a file to be migrated;
if the file to be migrated is in a state occupied by a process, acquiring a first path of the process occupying the file to be migrated;
if the first path is matched with a second path of any process in the white list process directory, eliminating occupation of the process corresponding to the first path on the file to be migrated;
and migrating the file to be migrated to a target migration position.
2. The method of claim 1, wherein the first path matches a second path of any process in a whitelisted process directory, comprising:
each field in the first path is sequentially matched with each field in the second path;
or,
the specified field in the first path matches the specified field in the second path.
3. The method of claim 1, further comprising, after the obtaining the first path of the process occupying the file to be migrated:
and if the first path is matched with the third path of any process in the blacklist process catalog, returning a prompt message of failure in migration of the file to be migrated.
4. A method according to any one of claims 1-3, further comprising, after said obtaining a first path of a process occupying said file to be migrated:
and if the first path is not matched with the paths of all the processes in the white list process directory and the black list process directory, sending the first path and the identification of the file to be migrated to a server.
5. The method of claim 4, further comprising, after said sending the first path and the identification of the file to be migrated to a server:
if the updated white list process catalog returned by the server is obtained, detecting a matching state between the first path and paths of all processes in the updated white list process catalog;
if the first path is matched with a fourth path of any process in the updated white list process directory, eliminating occupation of the process corresponding to the first path on the file to be migrated;
and migrating the file to be migrated to a target migration position.
6. A method according to any one of claims 1 to 3, wherein the file to be migrated is an associated file of any application, and further comprising, after said migrating the file to be migrated to the target migration location:
and updating the call address of the associated file in any application according to the target migration position.
7. A migration apparatus for a file, comprising:
the first acquisition module is used for acquiring files to be migrated;
the second acquisition module is used for acquiring a first path of a process occupying the file to be migrated when the file to be migrated is in a state occupied by the process;
the releasing module is used for releasing the occupation of the process corresponding to the first path on the file to be migrated when the first path is matched with the second path of any process in the white list process catalog;
and the migration module is used for migrating the file to be migrated to a target migration position.
8. The apparatus of claim 7, wherein the first path matches a second path of any process in a whitelisted process directory, comprising:
each field in the first path is sequentially matched with each field in the second path;
or,
the specified field in the first path matches the specified field of the second path.
9. The apparatus of claim 7, wherein the apparatus further comprises:
and the return module is used for returning the prompt message of the migration failure of the file to be migrated when the first path is matched with the third path of any process in the blacklist process catalog.
10. The apparatus of any one of claims 7-9, wherein the apparatus further comprises:
and the sending module is used for sending the first path and the identification of the file to be migrated to a server when the first path is not matched with the paths of all the processes in the white list process directory and the black list process directory.
11. The apparatus of claim 10, wherein the apparatus further comprises:
the detection module is used for detecting the matching state between the first path and the paths of all the processes in the updated white list process directory when the updated white list process directory returned by the server is acquired;
the releasing module is further configured to release, when the first path is matched with a fourth path of any process in the updated whitelist process directory, occupation of the process corresponding to the first path on the file to be migrated;
and the migration module is used for migrating the file to be migrated to a target migration position.
12. The apparatus according to any of claims 7-9, wherein the file to be migrated is an associated file of any application, the apparatus further comprising:
and the updating module is used for updating the call address of the associated file in any application according to the target migration position.
13. An electronic device comprising a processor and a memory;
wherein the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory for implementing the migration method of a file according to any one of claims 1 to 6.
14. A non-transitory computer readable storage medium having stored thereon a computer program, which when executed by a processor implements a method of migration of a file according to any of claims 1-6.
15. A computer program product comprising a computer program which, when executed by a processor, implements a method of migration of a file as claimed in any one of claims 1 to 6.
CN202011634800.0A 2020-12-31 2020-12-31 File migration method and device, electronic equipment and storage medium Active CN112711562B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011634800.0A CN112711562B (en) 2020-12-31 2020-12-31 File migration method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011634800.0A CN112711562B (en) 2020-12-31 2020-12-31 File migration method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112711562A CN112711562A (en) 2021-04-27
CN112711562B true CN112711562B (en) 2024-03-26

Family

ID=75547875

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011634800.0A Active CN112711562B (en) 2020-12-31 2020-12-31 File migration method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112711562B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0954690A (en) * 1995-08-11 1997-02-25 Fujitsu Ltd File replacement system
CN1559035A (en) * 2001-09-26 2004-12-29 Emc Efficient search for migration and purge candidates
CN102456049A (en) * 2010-10-28 2012-05-16 无锡江南计算技术研究所 Data migration method and device, and object-oriented distributed file system
CN102902765A (en) * 2012-09-25 2013-01-30 北京奇虎科技有限公司 Method and device for removing file occupation
CN105512151A (en) * 2014-10-16 2016-04-20 安一恒通(北京)科技有限公司 Method and device for removing file occupation
CN107656796A (en) * 2017-09-04 2018-02-02 顺丰科技有限公司 A kind of virtual machine cold moving method, system and equipment
CN111767086A (en) * 2019-03-28 2020-10-13 联发科技(新加坡)私人有限公司 Method and device for migrating browser data

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0954690A (en) * 1995-08-11 1997-02-25 Fujitsu Ltd File replacement system
CN1559035A (en) * 2001-09-26 2004-12-29 Emc Efficient search for migration and purge candidates
CN102456049A (en) * 2010-10-28 2012-05-16 无锡江南计算技术研究所 Data migration method and device, and object-oriented distributed file system
CN102902765A (en) * 2012-09-25 2013-01-30 北京奇虎科技有限公司 Method and device for removing file occupation
CN105512151A (en) * 2014-10-16 2016-04-20 安一恒通(北京)科技有限公司 Method and device for removing file occupation
CN107656796A (en) * 2017-09-04 2018-02-02 顺丰科技有限公司 A kind of virtual machine cold moving method, system and equipment
CN111767086A (en) * 2019-03-28 2020-10-13 联发科技(新加坡)私人有限公司 Method and device for migrating browser data

Also Published As

Publication number Publication date
CN112711562A (en) 2021-04-27

Similar Documents

Publication Publication Date Title
CN112486629B (en) Micro-service state detection method, micro-service state detection device, electronic equipment and storage medium
US10282120B2 (en) Method, apparatus and system for inserting disk
CN106843947B (en) Method and device for processing code defects
CN108898012B (en) Method and apparatus for detecting illegal program
CN106294387B (en) Data migration method and device
CN105045637A (en) Application start method and terminal
CN111353143A (en) Sensitive authority detection method and device and storage medium
CN109446825B (en) Method and device for expanding access control authority
CN112711562B (en) File migration method and device, electronic equipment and storage medium
CN105183799B (en) Authority management method and client
CN109918439B (en) Data synchronization method and loop detection method and related device applied by same
CN109739857B (en) Data distributed writing method and device under high concurrency, terminal and storage medium
CN109542808B (en) Method and device for controlling hard disk access
CN106657316B (en) Message withdrawing method and device
CN111680334B (en) Disk security access method, device, equipment and medium
CN110704244B (en) Disk offline processing method, device and equipment and readable storage medium
CN110806943B (en) Data updating method based on updating mark and related equipment
CN109800567B (en) Method and device for monitoring foreground application starting and terminal equipment
CN114253905A (en) File writing method, device and equipment based on directory quota
CN113032100A (en) Exception handling method, device, equipment and storage medium
CN111274208B (en) Method and device for locking file
CN109542300B (en) Method and device for updating web directory, electronic equipment and storage medium
CN112947991A (en) Method and device for acquiring version difference code file, computer equipment and medium
US20140298354A1 (en) Information processing apparatus, information processing method, and storage medium
CN112363980B (en) Data processing method and device of distributed system

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