A deno tool to handle directories a files

A deno tool to handle directories a files

A deno tool to handle directories a files. Inspired by rimraf and mkdirp mkdirp, fs-cli aims to write build scripts that can run under any shells.A deno tool to make a bundle: delete directoriesor files, copy simple or recursive, etc. Inspired by rimraf and mkdirp

fs-cli

A deno tool to handle directories a files. Inspired by rimraf and mkdirp mkdirp, fs-cli aims to write build scripts that can run under any shells.

Installation

$ deno install --unstable --allow-read --allow-write --allow-env --allow-run -n fs_cli https://deno.land/x/[email protected]/cli.ts

The above command will always install the latest version. If you're updating from an older version you might need to run the command with the -f flag.

To upgrade to latest version

To install a specific version, run the install command with a specific version tag:

$ deno install --unstable --allow-read --allow-write --allow-env --allow-run -n fs_cli https://deno.land/x/[email protected]<version>/cli.ts

To install a specific version

To install a specific version, run the install command with a specific version tag:

$ deno install --unstable --allow-read --allow-write --allow-env --allow-run -n fs_cli https://deno.land/x/[email protected]<version>/cli.ts

For more information see Deno's installer manual

Commands

cp

Syntax:

fs-cli cp <source path1 or glob1>...<source pathN glob1> <dest>

Perform a cp -r. If includes directories, thos directories are created if they does not exists.

  • To copy a file to anoter file:
fs-cli cp <source file> <dest dile>
  • To copy a file to a directory (keeping the same file name), add an OS separator (/ under unix, \ under windows) at the end of dest:
fs-cli cp <source file> <dest dir>/ or fs-cli cp <source file> <dest dir>\ 
  • To copy a file to directory (with another name) :
fs-cli cp <source file> <dest dir>/<dest file> or fs-cli cp <source file> <dest dir>\<dest file> 
  • To copy files to directory (with another name) :
fs-cli cp <source file1> ... <source filen> <dest dir>
  • To copy a directory to another directory:
fs-cli cp <source dir path> <dest dir path>

Options

cp supports glob options

force mode: -f/--force

Be default the command failed if a file has to be over written. -f/--force option allow to over write existing file

preserve timestamps: -p/--preserve

if use, set last modification and access times to the ones of the original source files. When not use, timestamp behavior is OS-dependent.

emptyDir

Syntax:

fs-cli emptyDir <dir1>...<dirn>

Ensures that each dir is empty. Deletes directory contents if the directory is not empty. If the directory does not exist, it is created.

mkdirp

Syntax:

fs-cli mkdirp <path1> <path2> <path3>

Perform an mkdir -p on each given directory.

rm

Syntax:

fs-cli rm <path or glob 1> <path or glob 2> ... <path or glob N>

Perform an rm -rf on each given directory and file. Globs are also supported. If a path does not exist, fs-cli ignores it and processes the next one.

Options

rm supports glob options

Glob Options

Following are used for rm and cp

To use glob intergated search rather than shell glob interpollation, don't forget to use quote to avoid glob being interpreted by sheel use quote: `'/_.tmp'__rahter than/_.tmp`

glob-root

root search for glob

fs-cli <command> <path or glob 1>...<path or glob N> --glob-root <path>

no-glob-dirs

Directories are ignored when applying a glob

fs-cli <command> <path or glob 1>...<path or glob N> --no-glob-dirs

no-glob-files

files are ignored when applying a glob

fs-cli <command> <path or glob 1>...<path or glob N> --no-glob-files

Global options

quiet mode: -q/--quiet

Output can be disable using -q/--quiet option:

fs-cli rm <path1> <path2> ... <pathN> -q

In case of failure, error message is always displayed, even in quiet mode.

dry run mode: -d/--dry

-d/--dry: Output the behavior, but does nothing

fs-cli rm <path1> <path2> ... <pathN> -d

What's new

0.7.5

  • use deno 1.5.1
  • use lib std 0.76.0

0.7.4

  • use deno 1.4.5
  • use lib std 0.74.0

0.7.3

  • use deno 1.4.4
  • use lib std 0.73.0

0.7.2

  • use deno 1.3.2
  • use lib std 0.6.0
  • use cliffy 0.13.0

0.7.1

  • use deno 1.2.0
  • use lib std 0.61.0
  • use cliffy 0.11.0

0.7.0

  • Added empty command
  • use lib std 0.59.0

0.6.0

  • cp command now supports glob options

0.5.1

  • cp command

0.4.0

  • mkdirp command

Todo

  • add messages at the end of execution (total number of deletion:copy...)
  • add follow Symlinks options to glob search

Download Details:

Author: franckLdx

Source Code: https://github.com/franckLdx/fs_cli

deno node nodejs javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

AEM Querybuilder for JavaScript (Browser, Node, Deno)

Helix Querybuilder .AEM Querybuilder for JavaScript (Browser, Node, Deno)

NKeys for JavaScript - Node.js, Browsers, and Deno

A public-key signature system based on Ed25519 for the NATS ecosystem system for JavaScript. The nkeys.js library works in Deno, Node.js, and the browser!

Javascript module for easily generating mazes,compatible with both Deno and Node

A work-in-progress Javascript maze generator module, compatible with both Deno and Node.

Deno Tutorial for Beginners: Deno vs. Node: Better Than NodeJS?

Deno is released, it’s time to find out if it can prove a worthy competition for Node.js. What is Deno? Why Deno can be considered an alternative to Node? The main differences between Deno and Node. Write a simple Deno app.

What is Deno? The Node.JS Killer? The Deno-minator to Node?

What is Deno? The Node.JS Killer? The Deno-minator to Node? Deno is the new hype and will it be better than node.js? Deno is a secure runtime for JavaScript and TypeScript that is based on the V8 JavaScript engine and the Rust programming language that addresses Node’s shortcomings