A folder sorting method, device and storage medium

By sorting folders and files before uploading folders on the web page, the problem of out-of-order files during uploading is solved, and folder management is efficient.

CN118295974BActive Publication Date: 2025-02-11GUANGZHOU BAOLUN ELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410513047.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-26
Publication Date
2025-02-11
Estimated Expiration
2044-04-26

AI Technical Summary

Technical Problem

When uploading folders on web pages, due to factors such as file size, transfer speed and format, files in the folder are prone to being out of order during uploading, resulting in inconsistently ranking of file lists after uploading and system files, resulting in files and folders The problem of out-of-order affects management efficiency.

Method used

By responding to the user's upload operation, obtain the folder and file information in the folder, sort it in alphabetical order of the folder and file names, generate a folder array and file array, and merge it into a sort field and submit it to the backend Perform secondary sorting and confirmation, and finally process it in the correct order when entering the database.

Benefits of technology

It realizes sorting folders and files before uploading folders, solves the problem of out-of-order files during uploading, and improves the efficiency of folder management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118295974B_ABST
    Figure CN118295974B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device and storage medium for sorting folders, belonging to the technical field of web development. The method comprises: in response to a user's upload operation on at least one first folder on a web page, obtaining folder information and file information of each level in the first folder; sorting the folder information and file information of each level in turn to generate a plurality of folder arrays and a plurality of file arrays; merging the plurality of folder arrays and file arrays to obtain a sort field; submitting the sort field to a web page back end, so that the web page back end performs secondary sorting confirmation on the first folder according to the sort field, and after confirmation, the folders and files in the first folder are stored in the order of the sort field, and the uploaded system data is generated, so as to realize uploading folders on the page and sorting the folders and files inside the folders before uploading the folders, thereby improving the efficiency of folder management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of web development, and in particular to a method, device and storage medium for sorting folders. Background Art

[0002] The folder upload function can be implemented on many web pages. For example, add attributes to the file selection input box to implement the native folder upload function; use plug-ins to upload folders on web pages.

[0003] However, after the folder upload function is implemented on the web page, various factors such as file size, file transfer speed, file format, etc. will affect the order of files in the folder during the upload process when uploading folders in the browser, resulting in inconsistency between the uploaded file list and the system file sorting, resulting in the problem of files and folders being out of order on the web page. After uploading, the operation and maintenance personnel have to change the file name, and the file management efficiency is low. Summary of the invention

[0004] The present invention provides a method, device and storage medium for sorting folders, so as to realize uploading folders from a page and sorting the folders and files inside the folders before uploading the folders, thereby improving the efficiency of folder management.

[0005] The present invention provides a sorting method for folders, including:

[0006] In response to a user's upload operation on at least one first folder on a webpage, obtaining folder information and file information of each level in the first folder;

[0007] Sort the folder information of each level in alphabetical order according to the folder names to generate several folder arrays;

[0008] Sort the file information of each level in alphabetical order according to the file names to generate several file arrays;

[0009] Merge several folder arrays and file arrays to obtain a sort field;

[0010] Submit the sort field to the web page backend so that the web page backend performs secondary sorting confirmation on the first folder according to the sort field. After confirmation, the folders and files in the first folder are stored in the order of the sort field to generate uploaded system data.

[0011] Furthermore, the user's upload operation on at least one first folder on the webpage is specifically as follows:

[0012] The user clicks the vue-simple-uploader component to upload the first folder, and the vue-simple-uploader component is a component in the vue-simple-uploader dependency, and the vue-simple-uploader dependency is installed in the vue project of the web page.

[0013] Furthermore, the obtaining of the folder information and file information of each level in the first folder is specifically as follows:

[0014] Get information about the first folder and the file list of each folder in the first folder;

[0015] The folder information and file information recorded in the same file list are determined as the folder information and file information of the same level;

[0016] Each of the file lists records the folder information and file information displayed by the current folder.

[0017] Furthermore, the folder information of each level is sorted in alphabetical order according to the names of the folders to generate several folder arrays, specifically:

[0018] Create a blank folder array;

[0019] Poll the name of each folder in the first-level folder information, increase the length of the blank folder array by 1 each time polling, and add the name of the currently polled folder to the blank folder array in alphabetical order to generate a first-level folder array, and obtain the folder array corresponding to each level.

[0020] Furthermore, the file information of each level is sorted in alphabetical order according to the file names to generate several file arrays, specifically:

[0021] Create a blank file array;

[0022] Poll the name of each file in the first level of file information, increase the length of the blank file array by 1 each time polling, and add the name of the currently polled file to the blank file array in alphabetical order of the name to generate a first level of file array, and obtain the file array corresponding to each level.

[0023] Furthermore, the plurality of folder arrays and file arrays are merged to obtain a sort field, specifically:

[0024] Merge the first-level folder array and file array to generate a sorted file list of the first level;

[0025] Merge the sorted file lists at each level to get the sort field.

[0026] Further, the sort field is submitted to the web page backend, so that the web page backend performs secondary sorting confirmation on the first folder according to the sort field, and after confirmation, the folders and files in the first folder are stored in the order of the sort field to generate uploaded system data, specifically:

[0027] Submit the sort field to the web page backend so that the web page backend performs secondary sorting confirmation on the first folder according to the sort field. After confirmation, replace the value of the file list before sorting of the first folder with the value of the sorted file list of each level in the sort field and upload it to generate uploaded system data.

[0028] Furthermore, after the system data for uploading is generated, the method further includes:

[0029] The file list of the uploaded first folder is obtained through the interface, and the file list of the first folder is displayed through a visual interface.

[0030] As a preferred solution, the present invention uses the vue-simple-uploader component to generate the function of uploading folders, obtains the secondary folders and file lists in the filelist object in the folder after uploading, and then sorts them according to requirements through the encapsulated function, and uploads them to the backend after sorting, thereby solving the problem of disordered upload folders. The present invention realizes uploading folders on the page and sorting the folders and the files inside the folders before uploading the folders, thereby improving the efficiency of folder management.

[0031] Other features and advantages of the present invention will be described in detail in the following detailed description.

[0032] Accordingly, the present invention also provides a folder sorting device, comprising: an information acquisition module, an information processing module and a sorting module;

[0033] The information acquisition module is used for acquiring folder information and file information of each level in at least one first folder in response to a user's upload operation on at least one first folder on a webpage;

[0034] The information processing module is used to sort the folder information of each level in alphabetical order of the folder names to generate a plurality of folder arrays;

[0035] Sort the file information of each level in alphabetical order according to the file names to generate several file arrays;

[0036] Merge several folder arrays and file arrays to obtain a sort field;

[0037] The sorting module is used to submit the sort field to the web page backend, so that the web page backend performs secondary sorting confirmation on the first folder according to the sort field. After confirmation, the folders and files in the first folder are stored in the order of the sort field to generate uploaded system data.

[0038] Correspondingly, the present invention also provides a computer-readable storage medium, which includes a stored computer program; wherein, when the computer program is running, it controls the device where the computer-readable storage medium is located to execute a folder sorting method as described in the content of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 It is a flowchart of an embodiment of a method for sorting folders provided by the present invention;

[0040] Figure 2 It is a structural schematic diagram of an embodiment of the file folder sorting device provided by the present invention. DETAILED DESCRIPTION

[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0042] Embodiment 1

[0043] Please refer to Figure 1 , a method for sorting folders provided by an embodiment of the present invention, comprising steps S101-S103:

[0044] Step S101: in response to a user's upload operation on at least one first folder on a webpage, obtaining folder information and file information of each level in the first folder;

[0045] Furthermore, the user's upload operation on at least one first folder on the webpage is specifically as follows:

[0046] The user clicks the vue-simple-uploader component to upload the first folder, and the vue-simple-uploader component is a component in the vue-simple-uploader dependency, and the vue-simple-uploader dependency is installed in the vue project of the web page.

[0047] In this embodiment, the vue-simple-uploader dependency is installed in the vue project of the web page, and the vue-simple-uploader component in the vue-simple-uploader dependency can be used to upload folders in the web page; users can upload files and folders, and the folders include: empty folders, folders with several files, and folders with several folders and several files.

[0048] Furthermore, the obtaining of the folder information and file information of each level in the first folder is specifically as follows:

[0049] Get information about the first folder and the file list of each folder in the first folder;

[0050] The folder information and file information recorded in the same file list are determined as the folder information and file information of the same level;

[0051] Each of the file lists records the folder information and file information displayed by the current folder.

[0052] Step S102: sorting the folder information of each level in alphabetical order of the folder names to generate a plurality of folder arrays;

[0053] Furthermore, the folder information of each level is sorted in alphabetical order according to the names of the folders to generate several folder arrays, specifically:

[0054] Create a blank folder array;

[0055] Poll the name of each folder in the first-level folder information, increase the length of the blank folder array by 1 each time polling, and add the name of the currently polled folder to the blank folder array in alphabetical order to generate a first-level folder array, and obtain the folder array corresponding to each level.

[0056] In this embodiment, the folder information at the same level includes: path information of each folder at the current level; the name of each folder can be obtained through the path information.

[0057] In this embodiment, the first letters of the names of the second folder and each folder are compared, and the names of the second folder are sorted in alphabetical order;

[0058] If the first letter of the name of the second folder is the same as the first letter of the name of the third folder, the names of the second folder and the third folders are compared to sort the names of the second folders in alphabetical order;

[0059] And so on, until the names of the second folder are sorted.

[0060] Step S103: sorting the file information of each level in alphabetical order of the file names to generate a plurality of file arrays;

[0061] Furthermore, the file information of each level is sorted in alphabetical order according to the file names to generate several file arrays, specifically:

[0062] Create a blank file array;

[0063] Poll the name of each file in the first level of file information, increase the length of the blank file array by 1 each time polling, and add the name of the currently polled file to the blank file array in alphabetical order of the name to generate a first level of file array, and obtain the file array corresponding to each level.

[0064] In this embodiment, the file information at the same level includes: path information of each file at the current level; the name of each file can be obtained through the path information.

[0065] In this embodiment, at the same level, the first letters of the names of the target file and each file are compared, and the names of the target file are sorted in alphabetical order;

[0066] If the first letter of the name of the target file is the same as the first file, the next letter of the name of the target file is compared with the first file, and the names of the target files are sorted in alphabetical order;

[0067] And so on, until the names of the second file are sorted.

[0068] In this embodiment, the 'sort()' method is used to sort the files and folders, and the first folder is polled to see if there is a folder, and then the sorting process is repeated for the folders and files in the folder.

[0069] Among them, the 'sort()' method is a native method of javascript, and the sort() function is a built-in function in javascript, which functions to sort.

[0070] For example: a user uploads a folder A (first-level folder) on the page. The order of the folder information and file information before sorting is: folder A contains second-level folders and second-level files;

[0071] The order of the secondary folders is: folder C and folder B, and the order of the secondary files is: file U and file T;

[0072] Folder C contains three levels of files, and the order of the three levels of files is: file M and file E.

[0073] The folder arrays obtained are: Array 1 (Folder A) and Array 2 (Folder B, Folder C);

[0074] The resulting file arrays are: Array 3 (file T, file U) and Array 4 (file E, file M).

[0075] The order of the sorted folder information and file information is as follows: the secondary folder in folder A contains secondary folders and secondary files;

[0076] The order of the secondary folders is: folder B and folder C, and the order of the secondary files is: file T and file U;

[0077] Folder C contains three levels of files, and the order of the three levels of files is: file E and file M.

[0078] Step S104: merging a plurality of the folder arrays and the file arrays to obtain a sort field;

[0079] Furthermore, the plurality of folder arrays and file arrays are merged to obtain a sort field, specifically:

[0080] Merge the first-level folder array and file array to generate a sorted file list of the first level;

[0081] Merge the sorted file lists at each level to get the sort field.

[0082] Step S105: Submit the sort field to the web page backend so that the web page backend performs secondary sorting confirmation on the first folder according to the sort field. After confirmation, the folders and files in the first folder are stored in the order of the sort field to generate uploaded system data.

[0083] Further, the sort field is submitted to the web page backend, so that the web page backend performs secondary sorting confirmation on the first folder according to the sort field, and after confirmation, the folders and files in the first folder are stored in the order of the sort field to generate uploaded system data, specifically:

[0084] Submit the sort field to the web page backend so that the web page backend performs secondary sorting confirmation on the first folder according to the sort field. After confirmation, replace the value of the file list before sorting of the first folder with the value of the sorted file list of each level in the sort field and upload it to generate uploaded system data.

[0085] Furthermore, after the system data for uploading is generated, the method further includes:

[0086] The file list of the uploaded first folder is obtained through the interface, and the file list of the first folder is displayed through a visual interface.

[0087] Implementing the embodiments of the present invention has the following effects:

[0088] The present invention uses the vue-simple-uploader component to generate the function of uploading folders. After uploading, the secondary folders and file lists in the filelist object in the folder are obtained, and then the encapsulated function is used to sort them according to the requirements. After the sorting is completed, it is uploaded to the back end, thereby solving the problem of disordered upload folders. The present invention realizes uploading folders on the page and sorting the folders and the files inside the folders before uploading the folders, thereby improving the efficiency of folder management.

[0089] Embodiment 2

[0090] Please refer to Figure 2 , a folder sorting device provided by an embodiment of the present invention, comprising: an information acquisition module 201, an information processing module 202 and a sorting module 203;

[0091] The information acquisition module is used for acquiring folder information and file information of each level in at least one first folder in response to a user's upload operation on at least one first folder on a webpage;

[0092] The information processing module is used to sort the folder information of each level in alphabetical order of the folder names to generate a plurality of folder arrays;

[0093] Sort the file information of each level in alphabetical order according to the file names to generate several file arrays;

[0094] Merge several folder arrays and file arrays to obtain a sort field;

[0095] The sorting module is used to submit the sort field to the web page backend, so that the web page backend performs secondary sorting confirmation on the first folder according to the sort field. After confirmation, the folders and files in the first folder are stored in the order of the sort field to generate uploaded system data.

[0096] The above-mentioned folder sorting device can implement the folder sorting method of the above-mentioned method embodiment. The optional items in the above-mentioned method embodiment are also applicable to this embodiment and will not be described in detail here. The rest of the contents of the embodiment of this application can refer to the contents of the above-mentioned method embodiment, and will not be repeated in this embodiment.

[0097] Embodiment 3

[0098] Correspondingly, the present invention also provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the folder sorting method described in any one of the above embodiments.

[0099] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of implementing specific functions, which are used to describe the execution process of the computer program in the terminal device.

[0100] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.

[0101] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal device, and uses various interfaces and lines to connect various parts of the entire terminal device.

[0102] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the terminal device by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the mobile terminal, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0103] Wherein, if the module / unit integrated in the terminal device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc.

[0104] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for sorting folders, characterized in that: include: In response to a user's upload operation on at least one first folder on a webpage, obtaining folder information and file information of each level in the first folder; Sort the folder information of each level in alphabetical order according to the folder names to generate several folder arrays; Sort the file information of each level in alphabetical order according to the file names to generate several file arrays; Merge several folder arrays and file arrays to obtain the sort field, which is specifically: Merge the first-level folder array and file array to generate a sorted file list of the first level; merge the sorted file lists of each level to obtain the sort field; Submit the sort field to the web page backend so that the web page backend performs secondary sorting confirmation on the first folder according to the sort field. After confirmation, the folders and files in the first folder are stored in the order of the sort field to generate uploaded system data.

2. A method for sorting folders as claimed in claim 1, characterized in that: The user's upload operation on at least one first folder on the webpage is specifically: The user clicks the vue-simple-uploader component to upload the first folder, and the vue-simple-uploader component is a component in the vue-simple-uploader dependency, and the vue-simple-uploader dependency is installed in the vue project of the web page.

3. A method for sorting folders as claimed in claim 2, characterized in that: The obtaining of the folder information and file information of each level in the first folder is specifically as follows: Get information about the first folder and the file list of each folder in the first folder; The folder information and file information recorded in the same file list are determined as the folder information and file information of the same level; Each of the file lists records the folder information and file information displayed by the current folder.

4. A method for sorting folders as claimed in claim 1, characterized in that: The folder information of each level is sorted in alphabetical order according to the names of the folders to generate several folder arrays, specifically: Create a blank folder array; Poll the name of each folder in the first-level folder information, increase the length of the blank folder array by 1 each time polling, and add the name of the currently polled folder to the blank folder array in alphabetical order to generate a first-level folder array, and obtain the folder array corresponding to each level.

5. A method for sorting folders as claimed in claim 1, characterized in that: The file information of each level is sorted in alphabetical order according to the file names to generate several file arrays, specifically: Create a blank file array; Poll the name of each file in the first level of file information, increase the length of the blank file array by 1 each time polling, and add the name of the currently polled file to the blank file array in alphabetical order of the name to generate a first level of file array, and obtain the file array corresponding to each level.

6. A method for sorting folders as claimed in claim 1, characterized in that: Submit the sort field to the web page backend, so that the web page backend performs secondary sorting confirmation on the first folder according to the sort field, and after confirmation, the folders and files in the first folder are stored in the order of the sort field to generate uploaded system data, specifically: Submit the sort field to the web page backend so that the web page backend performs secondary sorting confirmation on the first folder according to the sort field. After confirmation, replace the value of the file list before sorting of the first folder with the value of the sorted file list of each level in the sort field and upload it to generate uploaded system data.

7. A method for sorting folders as claimed in claim 1, characterized in that: After the system data for uploading is generated, the following steps are also included: The file list of the uploaded first folder is obtained through the interface, and the file list of the first folder is displayed through a visual interface.

8. A folder sorting device, characterized in that: include: Information acquisition module, information processing module and sorting module; The information acquisition module is used for acquiring folder information and file information of each level in at least one first folder in response to a user's upload operation on at least one first folder on a webpage; The information processing module is used to sort the folder information of each level in alphabetical order of the folder names to generate a plurality of folder arrays; Sort the file information of each level in alphabetical order according to the file names to generate several file arrays; Merge several folder arrays and file arrays to obtain the sort field, which is specifically: Merge the first-level folder array and file array to generate a sorted file list of the first level; merge the sorted file lists of each level to obtain the sort field; The sorting module is used to submit the sort field to the web page backend, so that the web page backend performs secondary sorting confirmation on the first folder according to the sort field. After confirmation, the folders and files in the first folder are stored in the order of the sort field to generate uploaded system data.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program; wherein, when the computer program is run, it controls the device where the computer-readable storage medium is located to execute a folder sorting method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • File sorting method and intelligent terminal

    CN106777383A

  • File transmission method and device, computer equipment and storage medium

    CN115297105A