Rust File Management CLI is a command-line tool written in Rust that provides essential file management functionalities. Whether you're working with files or directories, this tool simplifies common file operations with ease.

Overview

Rust FileOps

Rust File Management CLI is a command-line tool written in Rust that provides essential file management functionalities. Whether you're working with files or directories, this tool simplifies common file operations with ease.

Features

  • Show content: Shows the files of the directory.
  • Create file: Create a new file.
  • Create directory: Create a new directory/folder.
  • Append file: Append a word or a sentence in a file.
  • Search: Search for a word or expression in a file.
  • Replace: Replace a word or an expression in a file.
  • Delete file: Delete a particular file.
  • Delete directory: Delete a particular directory.

How to Use

  1. To use Rust File Operations, you need to have Rust installed on your system. You can install Rust from here.

  2. Clone the repository using this command.

  git clone https://github.com/Harikesh-14/Rust-FileOps.git
  1. To generate the target folder, enter the given below command
  cargo build
  1. To run the program, use the given below rule
  cargo run <file operation>

Show content

To list all the files and folders in a directory, follow these steps:

  1. Open a terminal or command prompt.

  2. Navigate to the directory where the project is located.

  3. Run the following command:

    For example:

    1. To search in a particular directory
    cargo run show <directory_name>
    1. To search in the current directory
    cargo run show .

Create a file

To create a file in the main directory, follow these steps:

  1. Open a terminal or command prompt.

  2. Navigate to the directory where the project is located.

  3. Run the following command:

    cargo run create -a <filename>

Create a directory

To create a directory in the main directory, follow these steps:

  1. Open a terminal or command prompt.

  2. Navigate to the directory where the project is located.

  3. Run the following command:

    cargo run newdir -a <directory name>

Appending in a file

To append a file in the main directory, follow these steps:

  1. Open a terminal or command prompt.

  2. Navigate to the directory where the project is located.

  3. Run the following command:

    cargo run write -a <filename>

Search Operation

To search for a word or expression in a file, follow these steps:

  1. Open a terminal or command prompt.

  2. Navigate to the directory where the project is located.

  3. Run the following command:

    cargo run search <word_to_search> <filename> <is_case_sensitive>

    Replace <word_to_search> with the word or expression you want to search for, <filename> with the name of the file to search in, and <is_case_sensitive> with true if you want the search to be case-sensitive, or false otherwise.

    For example:

    • This command searches for the word "Rust" in the file "example.txt" with case sensitivity enabled.
      cargo run search Rust example.txt true
    • This command searches for the word "Rust" in the file "example.txt" with case sensitivity disabled.
      cargo run search Rust example.txt false

Replace Operation

To replace a word or expression in a file, follow these steps:

  1. Open a terminal or command prompt.

  2. Navigate to the directory where the project is located.

  3. Run the following command:

    cargo run replace <word_to_replace> <new_word> <filename> <is_case_sensitive>

    Replace <word_to_replace> with the word or expression you want to replace, <new_word> with the word or expression you want to replace it with, <filename> with the name of the file to perform the replacement in, and <is_case_sensitive> with true if you want the replacement to be case-sensitive, or false otherwise.

    For example:

    • This command replaces the word "old" with "new" in the file "example.txt" with case sensitivity enabled.
      cargo run replace old example.txt true
    • This command replaces the word "old" with "new" in the file "example.txt" with case sensitivity disabled.
      cargo run replace old example.txt false

This addition will provide clear instructions on how to use the replace function in your Rust FileOps tool.

Delete a file

To delete a file, follow these steps:

  1. Open a terminal or command prompt.

  2. Navigate to the directory where the project is located.

  3. Run the following command:

    cargo run delete -d <filename>

    Replace <filename> with the name of the file you want to delete.

    For example:

    • This command deletes the file "example.txt" from the current directory.
      cargo run delete -d example.txt

Delete Directory Operation

To delete a directory, follow these steps:

  1. Open a terminal or command prompt.

  2. Navigate to the directory where the project is located.

  3. Run the following command:

    cargo run dldir -d <directory_name>

    Replace <directory_name> with the name of the directory you want to delete.

    For example:

    • This command deletes the directory "my_directory" from the current directory.
      cargo run dldir -d my_directory

Conclusion

Rust File Operations provides a simple yet powerful way to manipulate files using the Rust programming language. Whether you need to search for specific content in a file or perform more complex file operations, Rust File Operations has you covered.

We hope you find this tool useful for your file manipulation tasks. If you have any feedback, suggestions, or encounter any issues, please feel free to open an issue on our GitHub repository.

Happy file handling with Rust ❤️


You might also like...
tpp (Tera Pre-Processor) is a versatile CLI (Command Line Interface) tool crafted for preprocessing files using the Tera templating engine.

tpp (Tera Pre-Processor) is a versatile CLI (Command Line Interface) tool crafted for preprocessing files using the Tera templating engine. Drawing inspiration from pre-processors like cpp and gpp, tpp is the next evolution with its powerful expressive toolset.

Temporary files and directories with UTF-8 paths.

camino-tempfile A secure, cross-platform, temporary file library for Rust with UTF-8 paths. This crate is a wrapper around tempfile that works with th

Remove files or directories.

Wrm - Remove files or directories Installation Run the following Cargo command: cargo install wrm Usage To move files to trash($HOME/.local/share/wrm

A Rust library for evaluating log4j substitution queries in order to determine whether or not malicious queries may exist.

log4j_interpreter A Rust library for evaluating log4j substitution queries in order to determine whether or not malicious queries may exist. Limitatio

Detects whether a terminal supports unicode.

Detects whether a terminal supports unicode. This crate is a Rust port mashing together @sindresorhus' is-unicode-supported and @iarna's has-unicode N

Detects whether a terminal supports color, and gives details about that support

Detects whether a terminal supports color, and gives details about that support. It takes into account the NO_COLOR environment variable. This crate i

Test whether a given stream is a terminal

is-terminal Test whether a given stream is a terminal is-terminal is a simple utility that answers one question: Is this a terminal? A "terminal", als

Turn static CLI commands into TUIs with ease
Turn static CLI commands into TUIs with ease

lazycli Turn static CLI commands into TUIs with ease Demo: Usage Pick a command that spits out either a list or table of content, like ls, docker ps,

Command-line tool that provides a workflow for extending, editing, diffing, and writing to vim-style grep lines.

Grug Grug is a command-line tool that provides a workflow for expanding, editing, diffing, and writing edits to files using vim-styled grep lines (suc

Owner
Harikesh Ranjan Sinha
MERN Stack Developer
Harikesh Ranjan Sinha
RnR is a command-line tool to securely rename multiple files and directories that supports regular expressions

RnR is a command-line tool to securely rename multiple files and directories that supports regular expressions. Features Batch rename files and direct

Ismael González Valverde 219 Dec 31, 2022
locdev is a handy CLI tool that simplifies the process of adding, removing, and listing entries in the hosts file.

locdev ??️ locdev is a handy CLI tool that simplifies the process of adding, removing, and listing entries in the hosts file. You no longer need to de

Nick Rempel 20 Jun 5, 2023
H2O Open Source Kubernetes operator and a command-line tool to ease deployment (and undeployment) of H2O open-source machine learning platform H2O-3 to Kubernetes.

H2O Kubernetes Repository with official tools to aid the deployment of H2O Machine Learning platform to Kubernetes. There are two essential tools to b

H2O.ai 16 Nov 12, 2022
A cli tool to download specific GitHub directories or files

cloneit A cli tool to download specific GitHub directories or files. Installation From git git clone https://github.com/alok8bb/cloneit cd cloneit car

Alok 54 Dec 20, 2022
Voila is a domain-specific language launched through CLI tool for operating with files and directories in massive amounts in a fast & reliable way.

Voila is a domain-specific language designed for doing complex operations to folders & files. It is based on a CLI tool, although you can write your V

Guillem Jara 86 Dec 12, 2022
Upkeep your websites and web applications with ease from the comfort of the command line.

Upkeep Upkeep your websites and web applications with ease from the comfort of the command line. Explore the docs » View Demo · Report Bug · Request F

Kevin B 0 Dec 24, 2021
A command line tool and Rust library for working with recombination maps.

RecMap library (and command line tool) for reading and working with recombination maps in Rust A RecMap object can be created from reading in a HapMap

Vince Buffalo 5 Feb 11, 2024
Rust library that provides helpers for testing resilience of I/O operations.

partial-io Helpers for testing I/O behavior with partial, interrupted and blocking reads and writes. This library provides: PartialRead and PartialWri

null 31 Oct 26, 2022
Provides a cross platform way to shut down, reboot or log out operations

@napi-rs/system-shutdown This package provides a cross platform way to shut down, reboot or log out operations. Supported platforms: Linux, Windows an

LongYinan 7 Nov 2, 2023
Small command-line tool to switch monitor inputs from command line

swmon Small command-line tool to switch monitor inputs from command line Installation git clone https://github.com/cr1901/swmon cargo install --path .

William D. Jones 5 Aug 20, 2022