7
7
8
8
rmstale is a tool to remove stale files recursively below a given directory.
9
9
Files and folders older than a defined period are removed.
10
+ A file is considered stale if it has not been modified in the last N days, where N is the value provided for the ` --age ` flag.
11
+ This tool will also remove directories that are considered stale (older than the defined period) and are empty.
12
+
10
13
11
14
Some examples for use:
12
15
@@ -28,9 +31,14 @@ Some examples for use:
28
31
Visit the releases page to find the [ latest release] ( https://github.com/danstis/rmstale/releases/latest ) version.
29
32
30
33
``` bash
31
- curl -L -o /tmp/rmstale.tar.gz " https://github.com/danstis/rmstale/releases/download/v1.15.2/rmstale_1.15.2_linux_amd64.tar.gz"
32
- sudo tar -xzf /tmp/rmstale.tar.gz -C /usr/bin rmstale
33
- rm /tmp/rmstale.tar.gz
34
+ # Fetch the latest release tag from GitHub
35
+ latest_version=$( curl -s https://api.github.com/repos/danstis/rmstale/releases/latest | grep -Po ' "tag_name": "\K.*?(?=")' )
36
+ # Download the latest version tarball
37
+ curl -L -o rmstale.tar.gz " https://github.com/danstis/rmstale/releases/download/$latest_version /rmstale_${latest_version# v} _linux_amd64.tar.gz"
38
+ # Extract and install
39
+ sudo tar -xzf rmstale.tar.gz -C /usr/bin rmstale
40
+ # Cleanup
41
+ rm rmstale.tar.gz
34
42
```
35
43
36
44
### Install rmstale manually
@@ -42,21 +50,21 @@ rm /tmp/rmstale.tar.gz
42
50
43
51
### Command line flags
44
52
45
- | Flag | Description |
46
- | --------------- | ------------------------------------------------------------------------ |
47
- | -a, --age | Period in days before an item is considered stale |
48
- | -d, --dry-run | Runs the process in dry-run mode, no files will be removed. |
49
- | -e, --extension | Filter files for a defined file extension |
50
- | -p, --path | Path to a folder to process |
51
- | -v, --version | Displays the version of rmstale that is currently running |
52
- | -y, --confirm | Allows for processing without confirmation prompt, useful for scheduling |
53
+ | Flag | Description |
54
+ | --------------- | ------------------------------------------------------------------------------------------------------------------ |
55
+ | -a, --age | Period in days before an item is considered stale. |
56
+ | -d, --dry-run | Runs the process in dry-run mode. No files will be removed, but the tool will log the files that would be deleted. |
57
+ | -e, --extension | Filter files for a defined file extension. This flag only applies to files, not directories. |
58
+ | -p, --path | Path to a folder to process. |
59
+ | -v, --version | Displays the version of rmstale that is currently running. |
60
+ | -y, --confirm | Allows for processing without confirmation prompt, useful for scheduling. |
53
61
54
62
### Usage examples
55
63
56
64
``` cmd
57
65
>: rmstale --version
58
66
59
- rmstale v1.6.0
67
+ rmstale v1.2.3
60
68
```
61
69
62
70
``` cmd
@@ -70,6 +78,8 @@ WARNING: Will remove files and folders recursively below 'c:\temp' older than 14
70
78
-Removing 'C:\Temp\amc308D.tmp.LOG1'...
71
79
```
72
80
81
+ Any errors encountered during the deletion process (e.g., permission issues) will be logged.
82
+
73
83
## GitHub project
74
84
75
85
Feedback, Issues, Bugs and Contribution to this tool are welcome.
0 commit comments