Git Product home page Git Product logo

deepclean's Introduction

deepclean

be disrespectful to filesystem dirt โœจ๐Ÿ—‘๏ธโœจ

I often have a bunch of junk dependency files sitting around in my source folder that I don't actually need. Periodically I want to clean them up on inactive projects, as I recently discovered when I wanted to transfer my src dir to a new computer, and it was taking forever due to over half a million junk files in node_modules directories.

Currently looks for the following:

  • .bundle (Ruby Bundler)
  • node_modules (NodeJS NPM)
  • target (Rust Cargo, Scala SBT)

However it's easy to overrride this list.

Deepclean is very fast -- it will take advantage of multiple cores on your machine by gathering statistics for matched directories in parallel.

Nothing is actually deleted at the moment due to paranoia, just surfaced in the UI so the user can decide on their own how to handle.

TODO: only recommend these for deletion if they are .gitignore'd, not tracked in git.

Installation

Grab a compiled binary from the releases page, or on macOS with homebrew you can brew install mroth/formulas/deepclean.

Usage

Usage: deepclean [options] [dir]

Options:
  -sort
      sort output
  -target string
      dirs to scan for (default "node_modules,.bundle,target")

Will scan the current directory or dir if provided.

Errata

Why not find?

It is possible to do something similar with a monster shell command.

find . \( \
      -name 'node_modules' \
      -o -name '.bundle' \
      -o -name 'target' \
    \)  -prune \
    -exec sh -c 'echo "$(find "$0" | wc -l)\t$(du -sh "$0")"' {} \;

On my machine that takes about ~3.5sec total. In contrast deepclean is ~670ms. I'm on a fairly fast machine[*] and don't have a super large src dir. I imagine that these numbers should scale similarly on very large directories or slower disks.

[*]: 8-core Xeon, 2xSSD array in RAID-0.

deepclean's People

Contributors

dependabot[bot] avatar mroth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

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.