linux ssh quickly deletes many and small files, too many cache files

1: Problem description: Linux wants to delete the cache of a website, but there are countless small files in the cache, which add up to 300 G

2: Solution
0: The target directory to be deleted./caches
1: Create an empty directory
mkdir -p ./fordelete
2: Use rsync to delete synchronously, add /
rsync --delete-before -a- after writing the target directory H -v --progress --stats ./fordelete/ ./caches/

Parameter description:
-delete-before the receiver deletes before transmission
-progress displays the transmission process during transmission
-a archive mode, which means that files are transferred recursively, and all file attributes are
maintained -H keep hard-linked files
-v Details The output mode
-stats gives the transfer status of some files
without displaying the progress. You can use the following command
rsync --delete-before -a -H ./fordelete/ ./caches/

Guess you like

Origin blog.csdn.net/qq_38192709/article/details/112977748