abbbi / abbbi/nullfsvfs

Easily selectively destroy temp files

Đang mở
#2 1 bình luận 3 reaction 0 người được giao Xem trên GitHub
Usecase
Ngôn ngữ chính
C
Star
319
Fork
12
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## The Problem

Linux stores lots of cache files I don't give a damn about that take up many GBs of space. Today, I just reclaimed over 23 GB of space from just deleting one user's `~/.cache/` directories.

The issue arises that `rm` is not very safe and is very unwieldly when it comes to excluding patterns of files/directories I want to keep, while also having various race conditions of not deleting files added once the process starts.

To get past this, I wanted to use `rsync`, but it has no ability to JUST delete files. You have to copy them somewhere, first.

## The Solution

Enter `nullfsvfs`:

This is what I now have in my `/etc/cron.daily/clean-cache`:

```bash
#!/bin/bash

rsync -rv --remove-source-files --exclude={composer,spotify,skype,thumbnails,vim} /home/*/.cache/ /run/media/sinkhole/
for user in `ls /home`; do
find /home/$user/.cache/ -type d -empty -delete
done
```

-----

**Update:** I have officially released this as part of my [**BashScripts collection**](https://github.com/hopeseekr/BashScripts):

https://github.com/hopeseekr/BashScripts/blob/master/cron.daily/00_clear-cache

![image](https://user-images.githubusercontent.com/1125541/94863210-b7cad800-03ff-11eb-9734-19720785d045.png)

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.