Giter Site home page Giter Site logo

danstis / rmstale Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 1.0 203 KB

rmstale is a tool to remove stale files recursively below a given directory. Files and folders older than a defined period are removed.

License: MIT License

Go 70.68% PowerShell 2.93% Dockerfile 9.71% Shell 16.67%
chocolatey command-line-tool delete filesystem hacktoberfest management

rmstale's Introduction

Metrics

@danstis's Holopin board

rmstale's People

Contributors

danstis avatar dependabot[bot] avatar shadowhtfu avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

shadowhtfu

rmstale's Issues

Add feature to filter by file extention

Add a user, I would like the ability to filter the files by file extension, so that I can delete all files in the specified path with the selected extension.
IE: rmstale -path /tmp/ -extension log
Would remove all *.log files in the /tmp/ folder.

Confirmation is broken

❯ rmstale -a 300
WARNING: Will remove files and folders recursively below 'C:\Users\dan\AppData\Local\Temp' older than 300 days. Continue? (y/n) n
WARN : 22:17:16 Operation not confirmed, exiting.

❯ rmstale -a 300 -y
WARNING: Will remove files and folders recursively below 'C:\Users\dan\AppData\Local\Temp' older than 300 days. Continue? (y/n) n
WARN : 22:17:21 Operation not confirmed, exiting.

❯ rmstale -a 300 --confirm
WARNING: Will remove files and folders recursively below 'C:\Users\dan\AppData\Local\Temp' older than 300 days. Continue? (y/n)
ERROR: 22:17:27 Failed to read user input: unexpected newline
WARN : 22:17:27 Operation not confirmed, exiting.

Linux version is not working

When attempting to run the linux version of rmstale the following error message is returned.
:~$ ./rmstale
-bash: ./rmstale: cannot execute binary file: Exec format error

Add package to apt-get

As a developer,
I want the rmstale binary to be added to apt-get,
so I can install it on ubuntu with ease.

Fix chocolatey release process

The choco release process is broken due to changes in the GitHub actions:

Error: Unable to process command '::set-env name=CHOCOPUBLISH::true' successfully.
Error: The `set-env` command is disabled. Please upgrade to using Environment Files or opt into unsecure command execution by setting the `ACTIONS_ALLOW_UNSECURE_COMMANDS` 

Update the help output when running rmstale with no arguments

As a user, I want the help message that is displayed when you run the tool without arguments to be tidied up so the short and long arguments are presented on one line, so the output is easier to read.

For example, it currently outputs this:

❯ rmstale
  -a int
        Age in days to check for file modification.
  -age int
        Age in days to check for file modification.
  -confirm
        Don't prompt for confirmation.
  -e string
        Filter files by extension.
  -extension string
        Filter files by extension.
  -p string
        Path to check for stale files. (default "C:\\Users\\dan\\AppData\\Local\\Temp")
  -path string
        Path to check for stale files. (default "C:\\Users\\dan\\AppData\\Local\\Temp")
  -v    Display version information.
  -version
        Display version information.
  -y    Don't prompt for confirmation.

where it could output this:

❯ rmstale
  -a, --age int
        Age in days to check for file modification.
  -y, --confirm
        Don't prompt for confirmation.
  -e, --extension string
        Filter files by extension.
  -p, --path string
        Path to check for stale files. (default "C:\\Users\\dan\\AppData\\Local\\Temp")
  -v, --version
        Display version information.

Workflows are referencing vulnerable actions

Hello, there!

As part of the university research we are currently doing regarding the security of Github Actions, we noticed that one or many of the workflows that are part of this repository are referencing vulnerable versions of the third-party actions. As part of a disclosure process, we decided to open issues to notify GitHub Community.

Please note that there are could be some false positives in our methodology, thus not all of the open issues could be valid. If that is the case, please let us know, so that we can improve on our approach. You can contact me directly using an email: ikoishy [at] ncsu.edu

Thanks in advance

  1. The workflow build.yml is referencing action gittools/actions/gitversion/setup using references v0.9.9. However this reference is missing the commit 90150b4 which may contain fix to the vulnerability.
  2. The workflow build.yml is referencing action gittools/actions/gitversion/execute using references v0.9.9. However this reference is missing the commit 90150b4 which may contain fix to the vulnerability.
  3. The workflow build.yml is referencing action gittools/actions/gitversion/setup using references v0.9.9. However this reference is missing the commit 90150b4 which may contain fix to the vulnerability.
  4. The workflow build.yml is referencing action gittools/actions/gitversion/execute using references v0.9.9. However this reference is missing the commit 90150b4 which may contain fix to the vulnerability.

The vulnerability fix that is missing by actions' versions could be related to:
(1) CVE fix
(2) upgrade of vulnerable dependency
(3) fix to secret leak and others.
Please consider updating the reference to the action.

If you end up updating the reference, please let us know. We need the stats for the paper :-)

The root folder is attempted to be removed if it is stale and empty

When running against a folder under any OS, the root folder can be processed even though it states it will not remove it:

>:~$ ./rmstale --path /var/log/dist-upgrade/ --age 14
WARNING: Will remove files and folders recursively below '/var/log/dist-upgrade/' older than 14 days. Continue?: y
-Not removing folder '/var/log/dist-upgrade/' as it is the root folder...-Removing '/var/log/dist-upgrade/'...
ERROR: remove /var/log/dist-upgrade/: permission denied

Change format of log messages

It would be preferable to have the log messages updated to a more readable format.

Today they look like this:
INFO : 2018/03/08 14:40:40.643151 rmstale.go:118: Removing 'C:\Users\dan\AppData\Local\Temp\MSI6aeca.LOG'...

I propose they should look more like this:
INFO : 2018/03/08 14:40:40 : Removing 'C:\Users\dan\AppData\Local\Temp\MSI6aeca.LOG'...
or
2018/03/08 14:40:40 : INFO : Removing 'C:\Users\dan\AppData\Local\Temp\MSI6aeca.LOG'...

Ensure root directory is not removed

Currently the walkfunc could potentially remove the root directory if it is old and empty.
The desired behavior is to leave the root folder alone.

Add a whatif/dry run option

As a user,
I want to have a what-if or dry-run option,
so I can list the files that would be removed without performing the deletes.

Update names returned on removal to use correct slashes.

Currently the file path returned for removed files contains mixed slashes on Windows.
For example:

Removing "C:\\Temp\\rmstale\\/resources/AddEntry.ico"
Removing "C:\\Temp\\rmstale\\/resources/DeleteEntry.ico"
Removing "C:\\Temp\\rmstale\\/resources/EditEntry.ico"
Removing "C:\\Temp\\rmstale\\/resources/ProgressError.ico"
Removing "C:\\Temp\\rmstale\\/resources/ProgressSkip.ico"
Removing "C:\\Temp\\rmstale\\/resources/ProgressSuccess.ico"
Removing "C:\\Temp\\rmstale\\/resources/ProgressWarn.ico"
Removing "C:\\Temp\\rmstale\\/resources"

ci: update go releaser args to use --clean rather than --rm-dist

/opt/hostedtoolcache/goreleaser-action/1.15.2/x64/goreleaser release --rm-dist
Flag --rm-dist has been deprecated, please use --clean instead
  • starting release...
  • loading config file                              file=.goreleaser.yml
    • DEPRECATED: --rm-dist was deprecated in favor of --clean, check https://goreleaser.com/deprecations#-rm-dist for more details

Change tests to use testify

As a project maintainer,
I want the tests to be updated to use testify,
as goconvey seems to be end of life.

feat: allow short parameters as well as full params

As a user,
I would like to have the ability to provide parameters as the first letter only, as well as the full word,
so I don't have to continually type the full parameter name.

Example:
rmstale -age 14
should also accept
rmstale -a 14

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.