File storage method and electronic device
By obtaining and matching the characteristic information of files in electronic devices, and only storing soft link file identifiers in the target folder, the problem of storage space occupied by duplicate files is solved, and space saving and efficient file management are achieved.
Patent Information
- Application Number
- CN202110264774.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-11
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2041-03-11
AI Technical Summary
In the prior art, electronic devices tend to cause the problem of consuming large storage space of duplicate files when storing files.
By obtaining the file name information and file size information of the target file, it matches the feature information of the stored file. If it matches, a soft link file identifier with a smaller footprint is stored in the target folder, rather than a physical file. Avoid duplicate storage.
It effectively avoids the storage of duplicate files, saves users' storage space, and improves file management efficiency, meeting users' personalized needs.
Smart Images

Figure CN112988663B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of electronic technology, and specifically relates to a file storage method and an electronic device. Background Art
[0002] Generally, the storage function of an electronic device is widely used. For example, in a social scenario, files sent by friends are stored; in a file copying scenario, copied files are stored; in a downloading scenario, downloaded files are stored.
[0003] During the file storage process, if the folder used to store files includes a file that is the same as the current file, the user may be prompted to rename or delete it. If a folder other than the folder used to store files includes a file that is the same as the current file, the user will not be prompted but the file will be directly stored.
[0004] As more and more files are stored in electronic devices, more and more duplicate files are also present. It can be seen that the storage function in the prior art causes duplicate files to occupy a large storage space. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a file storage method that can solve the problem in the prior art that the storage function causes duplicate files to occupy a large storage space.
[0006] In a first aspect, an embodiment of the present application provides a file storage method, the method comprising: when storing a target file, obtaining target characteristic information of the target file; the target characteristic information comprises at least file name information and file size information; when the target characteristic information matches the first characteristic information of a first file, storing the target file identifier of the target file in a target folder; the first file is stored in a first folder, and the target folder is different from the first folder; wherein the target file identifier is associated with the storage path of the first file.
[0007] In a second aspect, an embodiment of the present application provides a file storage device, which includes: an acquisition module, used to acquire target characteristic information of the target file when storing the target file; the target characteristic information includes at least file name information and file size information; a storage module, used to store the target file identifier of the target file in a target folder when the target characteristic information matches the first characteristic information of the first file; the first file is stored in a first folder, and the target folder is different from the first folder; wherein the target file identifier is associated with the storage path of the first file.
[0008] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method of the first aspect.
[0009] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method of the first aspect are implemented.
[0010] In a fifth aspect, an embodiment of the present application provides a chip, the chip including a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the method of the first aspect.
[0011] Thus, in an embodiment of the present application, when an electronic device stores a target file, firstly, target feature information such as file name information and file size information of the target file is obtained, so as to match the obtained target feature information with the feature information of the file stored in the electronic device. If the target feature information matches the first feature information of the first file stored, it is considered that the electronic device has stored the same first file as the target file. Further, based on the target folder currently used to store the target file, a target file identifier for indicating the target file is stored in the target folder. The target file identifier is a soft link file, not a physical file, and occupies a small storage space. When the user operates the target file identifier, because the target file identifier is associated with the storage path of the first file that successfully matches, the first file can be opened based on the storage path of the associated first file, so as to be displayed as the target file. It can be seen that when storing files, the electronic device of this embodiment can cross different folders to detect whether it is a duplicate file, and when it is detected as a duplicate file, only a file identifier that occupies a small space is stored, so as to avoid repeated storage of the same file, thereby avoiding duplicate files from occupying too much storage space. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 is a flowchart of a file storage method according to an embodiment of the present application;
[0013] Figure 2 to Figure 6 is a schematic diagram of an interface of an electronic device according to an embodiment of the present application;
[0014] Figure 7 is a block diagram of a file storage device according to an embodiment of the present application;
[0015] Figure 8 This is one of the hardware structure diagrams of the file storage device of an embodiment of the present application.
[0016] Fig. 9This is the second hardware structure diagram of the file storage device of the embodiment of the present application. DETAILED DESCRIPTION
[0017] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0018] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0019] The file storage method provided by the embodiment of the present application is described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0020] Figure 1 A flowchart of a file storage method according to an embodiment of the present application is shown. The method is applied to an electronic device, and the method includes:
[0021] Step S1: when storing a target file, obtaining target feature information of the target file.
[0022] The application scenario of this embodiment is as follows: in a chat software, a user chats with a friend, receives pictures and other files sent by the friend, and clicks the "Save" control to store the pictures and other files.
[0023] Another application scenario of this embodiment is: in a chat software, when receiving pictures and other files sent by friends, the pictures and other files are automatically stored.
[0024] Another application scenario of this embodiment is: a user copies a file in an external device to an electronic device, thereby storing the copied file.
[0025] The target characteristic information at least includes file name information and file size information.
[0026] In this step, the purpose of obtaining the target feature information of the target file is to compare the target feature information with the feature information of the files stored in the electronic device to determine whether the system of the electronic device has stored the same file as the target file, thereby avoiding repeated storage of the same file.
[0027] Optionally, the target characteristic information includes file name information and file size information.
[0028] When the file name information and file size information of the target file are exactly the same as the file name information and file size information of a stored file, it means that the system of the electronic device has stored the same file as the target file.
[0029] Optionally, the target characteristic information may also include more feature information for comparison.
[0030] Optionally, the target file is any one of a picture, a document, a video, etc.
[0031] Step S2: When the target characteristic information matches the first characteristic information of the first file, the target file identifier of the target file is stored in the target folder.
[0032] The first file is stored in a first folder, and the target folder is different from the first folder.
[0033] In this embodiment, the target feature information matches the first feature information of the first file, which means that the target feature information of the target file is completely consistent with the first feature information of the first file.
[0034] The logo in this application is used to indicate text, symbols, images, interfaces, time, etc. of information, and controls or other containers can be used as carriers for displaying information, including but not limited to text logos, symbol logos, and image logos.
[0035] Optionally, the target file identifier is used to indicate the target file.
[0036] For example, the target file identifier is a shortcut icon used to represent the target file.
[0037] Usually, the storage space of an electronic device is divided into two parts. One part is the system partition. Users cannot write to this partition, but can only read it. There is no problem of writing duplicate files here. The other part is the data partition, which is the user-used space. This area is readable and writable; among them, the data partition management divides the kernel file system to manage the user's data. Therefore, the target folder and the first folder in this embodiment are both located in the data partition, and the kernel file system can monitor the events of the stored files in real time to avoid the phenomenon of writing duplicate files.
[0038] Furthermore, in this step, when storing the target file, the kernel file system accepts the task of creating the target file, and first queries whether a duplicate file already exists: if not, the target file is created and stored; if so, a shortcut icon for the target file is created and the target file identifier is stored.
[0039] The target file identifier is a soft link file, and the target file identifier is associated with the storage path of the first file.
[0040] When the user clicks the target file identifier, the first file may be opened as the target file based on the storage path of the first file.
[0041] Thus, in an embodiment of the present application, when an electronic device stores a target file, firstly, target feature information such as file name information and file size information of the target file is obtained, so as to match the obtained target feature information with the feature information of the file stored in the electronic device. If the target feature information matches the first feature information of the first file stored, it is considered that the electronic device has stored the same first file as the target file. Further, based on the target folder currently used to store the target file, a target file identifier for indicating the target file is stored in the target folder. The target file identifier is a soft link file, not a physical file, and occupies a small storage space. When the user operates the target file identifier, because the target file identifier is associated with the storage path of the first file that successfully matches, the first file can be opened based on the storage path of the associated first file, so as to be displayed as the target file. It can be seen that when storing files, the electronic device of this embodiment can cross different folders to detect whether it is a duplicate file, and when it is detected as a duplicate file, only a file identifier that occupies a small space is stored, so as to avoid repeated storage of the same file, thereby avoiding duplicate files from occupying too much storage space.
[0042] In the process of the file storage method of another embodiment of the present application, after step S1, it also includes:
[0043] Step A1: When the target characteristic information matches the first characteristic information of the first file, a target prompt message is output.
[0044] The target prompt message is used to prompt that the target characteristic information matches the first characteristic information of the first file.
[0045] In this embodiment, the output target prompt message is passed to the application layer, and the application layer delivers it to the user.
[0046] Optionally, if it is the first time to deliver to the user, the function guidance interface is actively entered for user settings.
[0047] Optionally, the user can also set it in advance.
[0048] See also Figure 2 Optionally, the setting scenario of this embodiment is as follows: in the setting interface, the user can select any one of the first two methods shown in the figure.
[0049] See also Figure 3 ,exist Figure 2 In the first method shown, the target prompt message is notified to the user through the notification bar in the form of a notification message.
[0050] See also Figure 4 ,exist Figure 2 In the second method shown, the target prompt message is notified to the user in the form of a prompt message through a pop-up window.
[0051] Among them, see Figure 3 and Figure 4 The control where the target prompt message is located also includes a first control and a second control. The first control is an option control such as "keep" or "allow", and the second control is an option control such as "delete" or "block".
[0052] Step A2: Receive a first input to a first control in a target prompt message.
[0053] The first input includes a touch input performed by a user on the screen, not limited to inputs such as click, slide, and drag; the first input may also be a first operation, which includes an air operation performed by the user, not limited to gesture operation, facial operation, etc. The first operation also includes an operation performed by a user on a physical button on the device, not limited to pressing, etc. Moreover, the first input includes one or more inputs, wherein the multiple inputs may be continuous or intermittent.
[0054] The application scenario is, for example, that the user clicks on the "Keep" option control; or, for example, that the user clicks on the "Allow" option control.
[0055] Step A3: In response to the first input, storing the target file in the target folder.
[0056] In this step, based on the user's selection, the target file may be stored in the target folder.
[0057] Optionally, the target file stored in this step is a physical file.
[0058] Optionally, based on user settings, this step may also store a target file identifier, where the target file identifier is a soft link file.
[0059] or,
[0060] Step A4: receiving a second input to a second control in the target prompt message.
[0061] The second input includes the touch input performed by the user on the screen, not limited to click, slide, drag and other inputs; the second input can also be a second operation, the first operation includes the user's air operation, not limited to gesture operation, facial operation, etc., and the second operation also includes the user's operation on the physical button on the device, not limited to pressing and other operations. Moreover, the second input includes one or more inputs, wherein the multiple inputs can be continuous or intermittent.
[0062] The application scenario is, for example, that a user clicks on a "Delete" option control; or, for another example, that a user clicks on a "Block" option control.
[0063] Step A5: In response to the second input, terminating the storage of the target file in the target folder.
[0064] In this step, based on the user's selection, the storage of the target file in the target folder is terminated, that is, the target file is not created in the target folder, and at the same time, the target file identifier is not created.
[0065] Further, the user may find the first file that is a duplicate of the target file in the first folder.
[0066] In this embodiment, the user can make pre-settings so that when duplicate files are stored, the user can choose to store or terminate the storage. This can prevent the electronic device from automatically storing a large number of duplicate files, save user space, and meet the user's personalized needs.
[0067] In the process of the file storage method of another embodiment of the present application, before step S2, the user can Figure 2 In the interface shown, select the fourth method.
[0068] exist Figure 2 In the fourth method shown, there is no need to output a target prompt message, but the file identifier is directly stored.
[0069] In this embodiment, the target file identifier is stored in the target folder, which does not occupy user space and allows the target file to be viewed in both the new directory (target folder) and the old directory (first folder).
[0070] In the process of the file storage method of another embodiment of the present application, after step S1, it also includes:
[0071] Step B1: When the target characteristic information matches the first characteristic information of the first file, storage of the target file in the target folder is terminated.
[0072] Before this step, users can Figure 2 In the interface shown, select the third method.
[0073] exist Figure 2 In the third method shown, there is no need to output a target prompt message, but the storage of the target file is directly terminated.
[0074] In this embodiment, in order to prevent duplicate files from occupying the storage space of the device, the operation of storing the target file and related contents may be directly terminated based on the user's settings.
[0075] In a file storage method according to another embodiment of the present application, the target folder is a preset folder.
[0076] Considering that monitoring the entire data partition may disturb users due to frequent reminders of files with the same name, we can actually recommend monitoring of folders where duplicate files appear frequently, allowing users to set which folders to monitor.
[0077] See also Figure 5 , setting scene, for example, in the setting interface, operate the "folder" control to display the folder setting interface, and in the folder setting interface, select the target folder as the preset folder.
[0078] For example, the target folder is a folder in the file storage directory corresponding to the social software. In another example, the target folder is an album folder.
[0079] In this way, the electronic device only monitors the folders preset by the user. Specifically, when files are being stored in the preset folders, it is determined whether there are duplicate files based on other files in the data partition.
[0080] In addition, when the target folder includes multiple subfolders, when storing files in any subfolder, it is possible to determine whether there are duplicate files based on the files in other subfolders in the target folder, thereby narrowing the matching range.
[0081] and / or;
[0082] The target folder and the first folder are both preset folders.
[0083] See also Figure 5 , setting scene, for example, in the setting interface, operate the "folder" control to display the folder setting interface, in the folder setting interface, select the target folder and the first folder as the preset folder.
[0084] For example, the target folder is a folder under the file storage directory corresponding to the social software, and the first folder is an album folder.
[0085] In this way, the electronic device only monitors the folders preset by the user. Specifically, when files are being stored in the preset folders, it is determined whether there are duplicate files based on all the files in the preset folders.
[0086] At the same time, the folders used for matching and comparison are not all data partitions, which can also reduce the probability of file duplication and further reduce the frequency of disturbing users due to file duplication.
[0087] and / or;
[0088] The target folder is located in the file storage directory corresponding to the preset application.
[0089] Considering that monitoring the entire data partition may disturb users due to frequent reminders of files with the same name, it is actually possible to recommend monitoring of applications with high frequency of duplicate files and let users set which applications to monitor.
[0090] See also Figure 5 , setting the scene, such as, in the setting interface, operating the "application list" control to display the setting interface of the application list, in the setting interface of the application list, selecting at least one application as a preset application so that the preset application includes a target folder.
[0091] In this way, the electronic device only monitors the folders under the file storage directory corresponding to the application program preset by the user. Specifically, when the folder under the file storage directory corresponding to the preset application program is storing files, it is determined whether there are duplicate files based on other files in the data partition.
[0092] In addition, when there are multiple folders under the file storage directory corresponding to the preset application, when storing files in any folder, it is possible to determine whether there are duplicate files based on the files in other folders under the file storage directory corresponding to the preset application, thereby narrowing the matching range.
[0093] and / or:
[0094] The target folder and the first folder are both located in the file storage directory corresponding to the preset application program.
[0095] See also Figure 5 , setting the scenario, such as, in the setting interface, operating the "application list" control to display the setting interface of the application list, in the setting interface of the application list, selecting at least one application as a preset application, so that the preset application includes the target folder and the first folder.
[0096] In this way, the electronic device only monitors the folders under the file storage directory corresponding to the preset application program. Specifically, when the folder under the file storage directory corresponding to the preset application program is storing files, it is determined whether there are duplicate files based on the files in all the folders under the file storage directory corresponding to the preset application program.
[0097] At the same time, the folders used for matching and comparison are not all data partitions, which can also reduce the probability of file duplication and further reduce the frequency of disturbing users due to file duplication.
[0098] and / or;
[0099] Both the target file and the first file belong to a preset file type.
[0100] Monitor one or several types of files, such as doc, excel, mov, jpg, png, pdf and other file types.
[0101] See also Figure 5 , setting scenario, such as, in the setting interface, operating the "file type" control to display the file type setting interface, in the file type setting interface, selecting at least one file type as the preset file type, so that the target file and the first file are both preset file types.
[0102] In this way, the electronic device only monitors the file types preset by the user. Specifically, when the electronic device is storing files of the preset file type, it determines whether there are duplicate files based on the same type of files in the data partition.
[0103] and / or;
[0104] Both the target file and the first file meet the preset file sizes.
[0105] Usually, there are many small files in electronic devices, but the space consumption is not large. Users can set the stored files to be processed only when they exceed a certain size, such as: the stored files are larger than 10MB.
[0106] See also Figure 5 , setting scenario, such as, in the setting interface, operating the "file size" control to display the file size setting interface, in the file size setting interface, select 10MB as the preset file size, so that the target file and the first file both meet the preset file size.
[0107] In this way, the electronic device only monitors files that meet the file size preset by the user. Specifically, when the electronic device is storing a file, and the file is larger than the preset file size, it is determined whether there are duplicate files based on the same type of files in the data partition.
[0108] In summary, various settings in this embodiment can be superimposed on each other to achieve the monitoring effect expected by the user, thereby avoiding duplicate files from occupying the user's usage space and avoiding the impact on the user due to frequent storage of duplicate files, which meets the user's personalized needs.
[0109] In the process of the file storage method of another embodiment of the present application, after step S2, it also includes:
[0110] Step C1: receiving a third input of a target file identifier.
[0111] The third input includes the touch input performed by the user on the screen, not limited to click, slide, drag and other inputs; the third input can also be a third operation, the third operation includes the user's air operation, not limited to gesture operation, facial movement operation, etc., and the third operation also includes the user's operation on the physical button on the device, not limited to pressing and other operations. Moreover, the third input includes one or more inputs, wherein the multiple inputs can be continuous or intermittent.
[0112] An application scenario is as follows: a user clicks a target file icon to enter a display interface of the target file.
[0113] Step C2: In response to the third input, determine that the file content of the first file is the file content of the target file, and display the file content of the target file.
[0114] In this step, based on the association between the target file identifier and the storage path of the first file, the first file is acquired through the storage path of the first file, thereby displaying the file content of the first file as the file content of the target file.
[0115] Step C3: Receive a fourth input of the file content of the target file.
[0116] The fourth input is used to update the file content of the target file.
[0117] The fourth input includes a touch input performed by a user on the screen, not limited to inputs such as click, slide, and drag; the fourth input may also be a fourth operation, which includes an air operation performed by a user, not limited to gesture operation, facial operation, etc. The fourth operation also includes an operation performed by a user on a physical button on the device, not limited to pressing, etc. Moreover, the fourth input includes one or more inputs, wherein the multiple inputs may be continuous or intermittent.
[0118] Application scenarios include users editing file contents.
[0119] Step C4: In response to the fourth input, the target file with updated file content is stored in the target folder.
[0120] Since the target file identifier is one of the soft link files of the first file, if the user needs to edit the file content in the target file, the target file can be stored after editing instead of storing the target file identifier. That is, the target folder stores a physical file.
[0121] Optionally, the user can Figure 5 In the setting interface shown, the "file editing" control is operated to display the setting interface of file editing, and the editing rules are set in the setting interface of file editing to enable the present embodiment to be implemented. For example, when the user needs to edit the content in the soft link file, first copy a physical file.
[0122] In this embodiment, in order to prevent duplicate files from occupying the user's space, the duplicate files can be stored in the form of file identifiers. When the user needs to edit the file indicated by the file identifier, in order to prevent the original file from being edited, a physical file can be stored again for the edited file, and the file is no longer a duplicate file. In this way, the stored original file and duplicate file are independent of each other, thereby ensuring the operability of each file.
[0123] In the process of the file storage method of another embodiment of the present application, when the first file is stored in the first folder, the method further includes:
[0124] Step D1: Receive a fifth input of the first file.
[0125] The fifth input includes the touch input performed by the user on the screen, not limited to click, slide, drag and other inputs; the fifth input can also be the fifth operation, the fifth operation includes the user's air operation, not limited to gesture operation, facial movement operation, etc., and the fifth operation also includes the user's operation on the physical button on the device, not limited to pressing and other operations. Moreover, the fifth input includes one or more inputs, wherein the multiple inputs can be continuous or intermittent.
[0126] The application scenario is, for example, that a user edits the file content of the first file; or, for example, that a user deletes the first file.
[0127] Step D2: In response to the fifth input, when the storage path of the first file is associated with at least one file identifier, hide the first file in the first folder.
[0128] When the user operates the first file, the storage path of the first file is associated with at least one file identifier, so the first file, as the original file, cannot be directly edited or deleted, etc. Instead, a copy is first retained as the original file and hidden in the first folder.
[0129] In this way, when the file identifier associated with the first file is operated, the file content indicated by the file identifier can be displayed based on the first file hidden in the first folder.
[0130] Optionally, the user can Figure 5 In the setting interface shown, the "file editing" and "file deletion" controls are operated to display the setting interfaces for file editing and file deletion respectively, and the editing rules and deletion rules are set in different interfaces to implement this embodiment.
[0131] Furthermore, based on the setting of the above rules, it can also be achieved that if the current file is a physical file and has no associated soft link file, the file is directly deleted; if the current file is a physical file and has an associated soft link file, the file is hidden and not actually deleted; if the current file is a soft link file, but the corresponding physical file has not been deleted, only the soft link file is deleted; if the current file is a soft link file, but the corresponding physical file has been deleted, the soft link file and the corresponding physical file are deleted.
[0132] In addition, based on the setting of the above rules, when the user edits the first file (ie, the original file), the first file is first hidden, the edited content is updated, and the edited file is stored. In order to distinguish, the edited file is defined as the second file.
[0133] See also Figure 6 Optionally, when a user deletes or edits a physical file, the user may be prompted with which soft-link files the current file is associated with. This way, the user can know how many applications want to operate a file, and thus understand the function of the file.
[0134] In this embodiment, when operating the original file, a copy of the original file before being operated needs to be retained. In this way, when the user operates the soft link file associated with the original file, it can be ensured that the soft link file is opened normally.
[0135] In a file storage method of another embodiment of the present application, when storing a target file, if the user renames the duplicate file based on the duplicate storage prompt, or the user actively renames the duplicate file, it is considered that the user wants to store a new file, and the default selection is to store a physical file with a new name.
[0136] Optionally, the user can Figure 5 In the setting interface shown, the "File Rename" control is operated to display the file rename setting interface. In the file rename setting interface, the processing rules for the renamed files are set to implement this embodiment.
[0137] In this embodiment, based on the user's operation of renaming the duplicate file, considering that the user needs to store the file, the file with the new name is stored, thereby meeting the user's needs.
[0138] In a file storage method according to another embodiment of the present application, when a user copies a file, the user can choose to copy a physical file or a soft link file.
[0139] Optionally, the user can Figure 5 In the setting interface shown, the "file copy" control is operated to display the file copy setting interface, and the processing rules for the copied files are set in the file copy setting interface to implement this embodiment. Among them, the user can choose to copy either the physical file or the soft link file.
[0140] For example, when the copied file is a duplicate file, the corresponding physical file or the soft link file may be copied based on the user's settings.
[0141] Optionally, after the user completes Figure 2 After the settings are shown, you can jump to Figure 5 The setting interface shown is used for the user to complete a series of settings.
[0142] In summary, in the embodiments of the present application, in view of the shortcomings of the background technology, the present application can avoid repeated storage of the same file, save the user's usage space, avoid the user's subsequent pain of cleaning up files, and the user does not need to worry about making the wrong file. In addition, the present application does not increase any cost, avoids frequent writing of duplicate data by applications, and can also monitor the amount of data written by applications.
[0143] It should be noted that the execution subject of the file storage method provided in the embodiment of the present application may be a file storage device, or a control module in the file storage device for executing the file storage method. In the embodiment of the present application, the file storage device executing the file storage method is taken as an example to illustrate the file storage device of the file storage method provided in the embodiment of the present application.
[0144] Figure 7 A block diagram of a file storage device according to another embodiment of the present application is shown, comprising:
[0145] The acquisition module 10 is used to acquire target characteristic information of the target file when storing the target file; the target characteristic information at least includes file name information and file size information;
[0146] The storage module 20 is used to store the target file identifier of the target file in the target folder when the target characteristic information matches the first characteristic information of the first file; the first file is stored in the first folder, and the target folder is different from the first folder;
[0147] The target file identifier is associated with the storage path of the first file.
[0148] Thus, in an embodiment of the present application, when an electronic device stores a target file, firstly, target feature information such as file name information and file size information of the target file is obtained, so as to match the obtained target feature information with the feature information of the file stored in the electronic device. If the target feature information matches the first feature information of the first file stored, it is considered that the electronic device has stored the same first file as the target file. Further, based on the target folder currently used to store the target file, a target file identifier for indicating the target file is stored in the target folder. The target file identifier is a soft link file, not a physical file, and occupies a small storage space. When the user operates the target file identifier, because the target file identifier is associated with the storage path of the first file that successfully matches, the first file can be opened based on the storage path of the associated first file, so as to be displayed as the target file. It can be seen that when storing files, the electronic device of this embodiment can cross different folders to detect whether it is a duplicate file, and when it is detected as a duplicate file, only a file identifier that occupies a small space is stored, so as to avoid repeated storage of the same file, thereby avoiding duplicate files from occupying too much storage space.
[0149] Optionally, the device further comprises:
[0150] An output module, used for outputting a target prompt message when the target characteristic information matches the first characteristic information of the first file; the target prompt message is used for prompting that the target characteristic information matches the first characteristic information of the first file;
[0151] A first input receiving module, used for receiving a first input to a first control in a target prompt message;
[0152] A first input response module is configured to store a target file in a target folder in response to a first input; or
[0153] A second input receiving module, used to receive a second input to a second control in the target prompt message;
[0154] The second input response module is used to terminate the storage of the target file in the target folder in response to the second input.
[0155] Optionally, the device further comprises:
[0156] The termination module is used to terminate the storage of the target file in the target folder when the target characteristic information matches the first characteristic information of the first file.
[0157] Optionally, the target folder is a preset folder; and / or;
[0158] The target folder and the first folder are both preset folders; and / or;
[0159] The target folder is located in a file storage directory corresponding to a preset application; and / or;
[0160] The target folder and the first folder are both located in a file storage directory corresponding to a preset application program; and / or;
[0161] The target file and the first file both belong to a preset file type; and / or;
[0162] Both the target file and the first file meet the preset file sizes.
[0163] Optionally, the device further comprises:
[0164] A third input receiving module, used to receive a third input of a target file identifier;
[0165] A third input response module, configured to determine, in response to a third input, that the file content of the first file is the file content of the target file, and display the file content of the target file;
[0166] A fourth input receiving module, used to receive a fourth input of the file content of the target file; the fourth input is used to update the file content of the target file;
[0167] The fourth input response module is used to store the target file after the file content is updated in the target folder in response to the fourth input.
[0168] Optionally, the device further comprises:
[0169] a fifth input receiving module, configured to receive a fifth input of the first file;
[0170] The fifth input response module is used to hide the first file in the first folder in response to the fifth input when the storage path of the first file is associated with at least one file identifier.
[0171] The file storage device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0172] The file storage device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0173] The file storage device provided in the embodiment of the present application can implement each process implemented in the above method embodiment, and will not be described again here to avoid repetition.
[0174] Alternatively, if Figure 8 As shown, an embodiment of the present application also provides an electronic device 100, including a processor 101, a memory 102, and a program or instruction stored in the memory 102 and executable on the processor 101. When the program or instruction is executed by the processor 101, each process of the above-mentioned file storage method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0175] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0176] Fig. 9 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0177] The electronic device 1000 includes but is not limited to: a radio frequency unit 1001, a network module 1002, an audio output unit 1003, an input unit 1004, a sensor 1005, a display unit 1006, a user input unit 1007, an interface unit 1008, a memory 1009, and a processor 1010 and other components.
[0178] Those skilled in the art will appreciate that the electronic device 1000 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 1010 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Fig. 9 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0179] Among them, the processor 1010 is used to obtain target characteristic information of the target file when storing the target file; the target characteristic information at least includes file name information and file size information; the memory 1009 is used to store the target file identifier of the target file in a target folder when the target characteristic information matches the first characteristic information of the first file; the first file is stored in a first folder, and the target folder is different from the first folder; wherein the target file identifier is associated with the storage path of the first file.
[0180] Thus, in an embodiment of the present application, when an electronic device stores a target file, firstly, target feature information such as file name information and file size information of the target file is obtained, so as to match the obtained target feature information with the feature information of the file stored in the electronic device. If the target feature information matches the first feature information of the first file stored, it is considered that the electronic device has stored the same first file as the target file. Further, based on the target folder currently used to store the target file, a target file identifier for indicating the target file is stored in the target folder. The target file identifier is a soft link file, not a physical file, and occupies a small storage space. When the user operates the target file identifier, because the target file identifier is associated with the storage path of the first file that successfully matches, the first file can be opened based on the storage path of the associated first file, so as to be displayed as the target file. It can be seen that when storing files, the electronic device of this embodiment can cross different folders to detect whether it is a duplicate file, and when it is detected as a duplicate file, only a file identifier that occupies a small space is stored, so as to avoid repeated storage of the same file, thereby avoiding duplicate files from occupying too much storage space.
[0181] Optionally, the processor 1010 is further used to output a target prompt message when the target feature information matches the first feature information of the first file; the target prompt message is used to prompt that the target feature information matches the first feature information of the first file; the user input unit 1007 is used to receive a first input to a first control in the target prompt message; the memory 1009 is further used to store the target file in the target folder in response to the first input; the user input unit 1007 is further used to receive a second input to a second control in the target prompt message; the processor 1010 is further used to terminate storing the target file in the target folder in response to the second input.
[0182] Optionally, the processor 1010 is further configured to terminate storing the target file in the target folder when the target characteristic information matches the first characteristic information of the first file.
[0183] Optionally, the target folder is a preset folder; and / or; the target folder and the first folder are both preset folders; and / or; the target folder is located in a file storage directory corresponding to a preset application; and / or; the target folder and the first folder are both located in a file storage directory corresponding to a preset application; and / or; the target file and the first file both belong to a preset file type; and / or; the target file and the first file both meet a preset file size.
[0184] Optionally, the user input unit 1007 is further used to receive a third input for the target file identifier; the processor 1010 is further used to determine, in response to the third input, that the file content of the first file is the file content of the target file, and display the file content of the target file; the user input unit 1007 is further used to receive a fourth input for the file content of the target file; the fourth input is used to update the file content of the target file; the memory 1009 is further used to store the target file with updated file content in the target folder in response to the fourth input.
[0185] Optionally, when the first file is stored in a first folder, the user input unit 1007 is further used to receive a fifth input on the first file; the processor 1010 is further used to hide the first file in the first folder in response to the fifth input, when the storage path of the first file is associated with at least one file identifier.
[0186] In summary, in the embodiments of the present application, in view of the shortcomings of the background technology, the present application can avoid repeated storage of the same file, save the user's usage space, avoid the user's subsequent pain of cleaning up files, and the user does not need to worry about making the wrong file. In addition, the present application does not increase any cost, avoids frequent writing of duplicate data by applications, and can also monitor the amount of data written by applications.
[0187] It should be understood that in the embodiment of the present application, the input unit 1004 may include a graphics processor (Graphics Processing Unit, GPU) 10041 and a microphone 10042, and the graphics processor 10041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 1006 may include a display panel 10061, and the display panel 10061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1007 includes a touch panel 10071 and other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 may include two parts: a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, a physical keyboard, a function key (such as a volume control button, a switch button, etc.), a trackball, a mouse, and a joystick, which will not be repeated here. The memory 1009 can be used to store software programs and various data, including but not limited to applications and operating systems. The processor 1010 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 1010.
[0188] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned file storage method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0189] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0190] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned file storage method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0191] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0192] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0193] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0194] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A file storage method, characterized in that: The method comprises: When the user stores a target file in a target folder, target feature information of the target file is obtained; the target feature information at least includes file name information and file size information; When the target characteristic information matches the first characteristic information of the first file, storing the target file identifier of the target file in a target folder; the first file is stored in a first folder, and the target folder is different from the first folder; The target file identifier is associated with the storage path of the first file, and the target folder is a folder preset in the setting interface; The method further includes: when the target characteristic information matches the first characteristic information of the first file, terminating the storage of the target file in the target folder.
2. The method according to claim 1, characterized in that After obtaining the target feature information of the target file, the method further includes: When the target characteristic information matches the first characteristic information of the first file, outputting a target prompt message; the target prompt message is used to prompt that the target characteristic information matches the first characteristic information of the first file; Receiving a first input to a first control in the target prompt message; In response to the first input, storing the target file in the target folder; or, receiving a second input to a second control in the target prompt message; In response to the second input, storing the target file in the target folder is terminated.
3. The method according to claim 1, characterized in that The target folder is a preset folder; and / or; The target folder and the first folder are both preset folders; and / or; The target folder is located in a file storage directory corresponding to a preset application; and / or; The target folder and the first folder are both located in a file storage directory corresponding to a preset application; and / or; The target file and the first file both belong to a preset file type; and / or; The target file and the first file both meet the preset file size.
4. The method according to claim 1, characterized in that: After storing the target file identifier of the target file in the target folder, the method further includes: receiving a third input of the target file identifier; In response to the third input, determining that the file content of the first file is the file content of the target file, and displaying the file content of the target file; receiving a fourth input of the file content of the target file; the fourth input is used to update the file content of the target file; In response to the fourth input, the target file after updating the file content is stored in the target folder.
5. The method according to claim 1, characterized in that In the case where the first file is stored in a first folder, the method further includes: receiving a fifth input of the first file; In response to the fifth input, when the storage path of the first file is associated with at least one file identifier, the first file is hidden in the first folder.
6. A file storage device, characterized in that: The device comprises: An acquisition module, used for acquiring target feature information of the target file when storing the target file; the target feature information at least includes file name information and file size information; a storage module, configured to store a target file identifier of the target file in a target folder if the target characteristic information matches the first characteristic information of the first file; the first file is stored in a first folder, and the target folder is different from the first folder; The target file identifier is associated with the storage path of the first file, and the target folder is a folder preset in the setting interface; The device is also used to stop storing the target file in the target folder when the target characteristic information matches the first characteristic information of the first file.
7. The device according to claim 6, characterized in that The device further comprises: An output module, configured to output a target prompt message when the target characteristic information matches the first characteristic information of the first file; the target prompt message is used to prompt that the target characteristic information matches the first characteristic information of the first file; A first input receiving module, used for receiving a first input to a first control in the target prompt message; A first input response module is configured to store the target file in the target folder in response to the first input; or A second input receiving module, used for receiving a second input to a second control in the target prompt message; A second input response module is configured to terminate storing the target file in the target folder in response to the second input.
8. The device according to claim 6, characterized in that The target folder is a preset folder; and / or; The target folder and the first folder are both preset folders; and / or; The target folder is located in a file storage directory corresponding to a preset application; and / or; The target folder and the first folder are both located in a file storage directory corresponding to a preset application; and / or; The target file and the first file both belong to a preset file type; and / or; The target file and the first file both meet the preset file size.
9. The device according to claim 6, characterized in that The device further comprises: A third input receiving module, used for receiving a third input of the target file identifier; A third input response module, configured to determine, in response to the third input, that the file content of the first file is the file content of the target file, and display the file content of the target file; A fourth input receiving module, used to receive a fourth input of the file content of the target file; the fourth input is used to update the file content of the target file; The fourth input response module is used to store the target file after updating the file content in the target folder in response to the fourth input.
10. The device according to claim 6, characterized in that The device further comprises: a fifth input receiving module, configured to receive a fifth input of the first file; A fifth input response module is used to hide the first file in the first folder in response to the fifth input when the storage path of the first file is associated with at least one file identifier.
11. An electronic device, characterized in that: The method comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the file storage method according to any one of claims 1 to 5.
12. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the file storage method according to any one of claims 1 to 5 are implemented.
