# US 12,117,965 B2 · File processing method, apparatus and device, and readable storage medium

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 12,117,965 B2
- Document ID: US12117965B2
- Status: Granted
- Kind: B2
- Application number: 18/261,060
- Filed: 2021-12-30
- Published: 2024-05-23
- Granted: 2024-10-15
- Earliest claimed: 2021-08-10
- Assignees: Inspur Suzhou Intelligent Technology Co., Ltd.
- Applicants: Inspur Suzhou Intelligent Technology Co., Ltd.
- Inventors: Ruqing Xu
- Web page: https://patentgrep.com/patent/US12117965B2

## CPC

- G06F 16/16: File or folder operations, e.g. details of user interfaces specifically adapted to file systems
- G06F 16/162: {Delete operations (erasing in storage systems G06F3/0652)}
- G06F 16/17: Details of further file system functions
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Provided are a file processing method, apparatus and device, and a readable storage medium. The method includes: judging whether a received file access path exists; if so, judging whether the file access path corresponds to a folder; if so, generating a folder stream, traversing the folder stream, and generating a file object corresponding to the folder stream; storing the file object in a memory, acquiring the size of a corresponding file according to the file object, detecting whether there is a file in the folder, and a size of the file is known and the file has been traversed and used, and if so, deleting, from the memory, the file object corresponding to the file; and acquiring the total size of files in the folder according to the size of each file in the folder.

## Claims

### Claim 1

A file processing method, comprising:
receiving a file access path;
when the file access path exists and the file access path corresponds to a folder, generating a folder stream according to the folder, traversing the folder stream, and generating a file object corresponding to the folder stream;
storing the file object in a memory, acquiring a size of a corresponding file according to the file object, and when it is detected that there is a file in the folder, and a size of the file is known and the file has been traversed and used, deleting, from the memory, the file object corresponding to the file; and
acquiring a total size of files in the folder according to a size of each file in the folder;
wherein before generating the folder stream according to the folder, the method further comprises:
when there is a sub-folder in the folder, screening out the sub-folder from the folder; and
the step of generating the folder stream according to the folder and traversing the folder stream comprises:
generating the folder stream according to files in the folder, wherein the files are located at the same level as the sub-folder;
generating a sub-folder stream according to files contained in the sub-folder; and
traversing the folder stream, and traversing the sub-folder stream after the traversal of the folder stream is completed.

### Claim 2 (depends on 1)

The file processing method according to claim 1, wherein after generating the folder stream according to the folder, the method further comprises:
generating an iterator according to the folder stream; and
the step of traversing the folder stream comprises:
traversing the folder stream by using the iterator.

### Claim 3 (depends on 1)

The file processing method according to claim 1, wherein when it is determined that the file access path corresponds to an access file, the method further comprises:
generating a file object corresponding to the access file, storing, in the memory, the file object corresponding to the access file, and acquiring a size of the access file according to the file object corresponding to the access file.

### Claim 4 (depends on 1)

The file processing method according to claim 1, wherein traversing the folder stream comprises:
when a file in the folder stream is a valid file, performing the step of traversing the folder stream and generating the file object corresponding to the folder stream.

### Claim 5 (depends on 4)

The file processing method according to claim 4, wherein the valid file is a non-shortcut file.

### Claim 6 (depends on 4)

The file processing method according to claim 4, when a file in the folder stream is a invalid file, skipping the invalid file and processing a next file.

### Claim 7 (depends on 6)

The file processing method according to claim 6, wherein the invalid file is a shortcut file.

### Claim 8 (depends on 1)

The file processing method according to claim 1, wherein when it is determined that the file access path does not exist, the method further comprises:
sending a prompt of file access path error.

### Claim 9 (depends on 1)

The file processing method according to claim 1, wherein the folder stream is generated by queuing files contained in the folder.

### Claim 10 (depends on 1)

The file processing method according to claim 1, wherein generating the file object corresponding to the folder stream comprises:
sequentially reading the files contained in the folder, and once a file is read, generating a file object corresponding to the file.

### Claim 11

A file processing device, comprising a memory and one or more processors, wherein the memory stores computer-readable instructions, and the computer-readable instructions are configured to cause, when executed by the one or more processors, the one or more processors to:
receive a file access path;
when the file access path exists and the file access path corresponds to a folder, generate a folder stream according to the folder, traverse the folder stream, and generate a file object corresponding to the folder stream;
store the file object in a memory, acquire a size of a corresponding file according to the file object, and when it is detected that there is a file in the folder, and a size of the file is known and the file has been traversed and used, delete, from the memory, the file object corresponding to the file; and
acquire a total size of files in the folder according to a size of each file in the folder;
wherein the computer-readable instructions are further configured to cause the one or more processors to:
when there is a sub-folder in the folder, screen out the sub-folder from the folder; and
generate the folder stream according to files in the folder, wherein the files are located at the same level as the sub-folder;
generate a sub-folder stream according to files contained in the sub-folder; and
traverse the folder stream, and traverse the sub-folder stream after the traversal of the folder stream is completed.

### Claim 12 (depends on 11)

The file processing device according to claim 11, wherein the computer-readable instructions are further configured to cause the one or more processors to:
generate an iterator according to the folder stream; and
traverse the folder stream by using the iterator.

### Claim 13 (depends on 11)

The file processing device according to claim 11, wherein the computer-readable instructions are further configured to cause the one or more processors to:
generate a file object corresponding to the access file, store, in the memory, the file object corresponding to the access file, and acquire a size of the access file according to the file object corresponding to the access file.

### Claim 14 (depends on 11)

The file processing device according to claim 11, wherein the computer-readable instructions are further configured to cause the one or more processors to:
when a file in the folder stream is a valid file, perform the step of traversing the folder stream and generating the file object corresponding to the folder stream.

### Claim 15 (depends on 11)

The file processing device according to claim 11, wherein the computer-readable instructions are further configured to cause the one or more processors to:
when it is determined that the file access path does not exist, send a prompt of file access path error.

### Claim 16 (depends on 11)

The file processing device according to claim 11, wherein the folder stream is generated by queuing files contained in the folder.

### Claim 17 (depends on 11)

The file processing device according to claim 11, wherein the computer-readable instructions are further configured to cause the one or more processors to:
sequentially read the files contained in the folder, and once a file is read, generate a file object corresponding to the file.

### Claim 18

A non-transitory computer-readable storage media storing computer-readable instructions, wherein the computer-readable instructions are configured to cause, when executed by one or more processors, the one or more processors to:
receive a file access path;
when the file access path exists and the file access path corresponds to a folder, generate a folder stream according to the folder, traverse the folder stream, and generate a file object corresponding to the folder stream;
store the file object in a memory, acquire a size of a corresponding file according to the file object, and when it is detected that there is a file in the folder, and a size of the file is known and the file has been traversed and used, delete, from the memory, the file object corresponding to the file; and
acquire a total size of files in the folder according to a size of each file in the folder;
wherein the computer-readable instructions are configured to cause, when executed by one or more processors, the one or more processors to:
when there is a sub-folder in the folder, screen out the sub-folder from the folder; and
generate the folder stream according to files in the folder, wherein the files are located at the same level as the sub-folder;
generate a sub-folder stream according to files contained in the sub-folder; and
traverse the folder stream, and traverse the sub-folder stream after the traversal of the folder stream is completed.
