Code Monkey home page Code Monkey logo

directory-search-rs's Introduction

ds-rs

Usage

To run ds-rs, use the command ds:

> ds --help
A command to search and display directory structures.

Usage: ds.exe [OPTIONS]

Options:
  -p, --path <PATH>      The path at which to start. If unspecified, the current directory is used.
  -r, --recursive        Enables recursion
  -d, --depth <DEPTH>    The depth to which to recurse. If unspecified, the depth is unlimited.
  -f, --show-files       Displays files along with directories
  -s, --show-symlinks    Displays symlinks along with directories
  -m, --matches <REGEX>  Only display directories, files and symlinks which match the given regex
  -h, --help             Print help
  -V, --version          Print version

Regex

The regex parser is the one used by the Rust regex crate. This means that the regex can match anywhere in a string. Therefore, the regex "a" matches any file name with an "a" in it. The start of a string can be matched with ^, and the end of a string can be matched with $. Most special characters, such as ".", must be escaped with a backslash ("\")

Examples

Display the directories inside a directory

> ds --path "C:/Users/%USERNAME%/Documents"
Displaying contents of "C:/Users/%USERNAME%/Documents"
="Github"
="Projects"

Display the entire contents of a directory

> ds --path "C:/Users/%USERNAME%/Documents" -f -s
Displaying contents of "C:/Users/%USERNAME%/Documents"
="GitHub"
="Projects"
-"Resume.docx"
-"Resume.pdf"

Display the entire contents of a directory recursively up to a depth of 3:

> ds --path "C:/Users/%USERNAME%/Documents" -r --depth 3 -f -s
Displaying contents of "C:/Users/%USERNAME%/Documents"
="GitHub"
="Projects"
 ="Python"
  ="python_project_1"
  ="python_project_2"
  -"python_script.py"
 ="Rust"
  ="directory-search-rs"
  -"new_bin_and_lib.bat"
-"Resume.docx"
-"Resume.pdf"

Display the entire contents of a directory recursively up to a depth of 4, only showing the files that end in .py:

> ds --path "C:/Users/%USERNAME%/Documents" -r --depth 4 -f -s --matches \.py$
Displaying contents of "C:/Users/%USERNAME%/Documents"
="Projects"
 ="Python"
  ="python_project_1"
   -"main.py"
   -"utils.py"
  ="python_project_2"
   -"main.py"
  -"python_script.py"

Note that while even though none of the folders end in .py, they are still displayed in order to show directory structure.

Installation

cargo install

The easiest way to install this binary is through cargo install:

cargo install ds-rs

Build from source

To build from source, clone the git repository, build with cargo, and move the binary to a stable folder.

> git clone https://github.com/mysteriouslyseeing/directory-search-rs
> cd directory-search-rs
> cargo build --release
> cp ./target/release/ds /path/to/destination/

directory-search-rs's People

Contributors

mysteriouslyseeing 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.