GithubHelp home page GithubHelp logo

siddhant-k-code / scalable-ls Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 0.0 61 KB

Rust implementation of: http://be-n.com/spw/you-can-list-a-million-files-in-a-directory-but-not-with-ls.html

Home Page: https://x.com/Siddhant_K_code/status/1766090204241162311?s=20

Shell 3.08% Rust 96.92%
list-files ls rust rust-lang linux scaleable

scalable-ls's Introduction

scalable-ls

Rust implementation of this blog or discussion

Introduction

scalable-ls is a Rust-based command-line tool designed to list the contents of directories containing an extremely large number of files. Traditional tools like ls can struggle or fail in these environments, but scalable-ls is optimized to handle such scenarios efficiently.

Installation

Ensure you have Rust and Cargo installed on your system. Clone this repository and navigate to the project directory. Build the project using Cargo:

cargo build --release

Usage

Create empty files

To create a directory and populate it with empty files under demo-files directory, use the following command:

./create_files.sh

To list the files in a directory, use the following command:

cargo run -- [OPTIONS] <PATH>

Options:

  • -b, --buf_size <BUF_SIZE>: Set the buffer size for reading directory entries (default is 5MB).

Example:

cargo run -- ./demo_files/
cargo run -- --buf-size 1000000 ./demo_files/

Features

  • Handles directories with millions of files.
  • Efficient directory listing without hanging or crashing.
  • Customizable buffer size for performance tuning.

Example

For 20000 files, both seem to be working. But, it could fail for larger number of files & also output is inconsistent in native ls in case of large numbers of files:

image

scalable-ls's People

Contributors

siddhant-k-code avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.