1.1.9 • Published 4 years ago
@fc.sh/fs-tools v1.1.9
@fc.sh/fs-tools
This tool is for operating files.
Install
install globally
# use npm
npm install -g @fc.sh/fs-tools
# use yarn
yarn global add @fc.sh/fs-tools
Usage
rename files
@fc.sh/fs-tools rename <sourcePath> <targetPath> -e <ignoreFilePath> -dry
sourcePath accepts glob pattern targetPath accepts both relative and absolute path, and also accepts two special characters:
%name
: replace with the source file name without extension (e.g.%name.txt
->hello.txt
)%ext
: replace with the source file extension (e.g.hello.%ext
->hello.txt
)
examples
@fc.sh/fs-tools rename './**/*.htm' '*.html' -e '**/node_modules/**'
@fc.sh/fs-tools rename './**/*.htm' '%name.html' -e '**/node_modules/**' # rename all .htm files to .html
@fc.sh/fs-tools rename './**/*.html' 'hello%ext' -e '**/node_modules/**' # rename all .html files to hello.html
@fc.sh/fs-tools rename './**/*.htm' '%name.html' -e '**/node_modules/**,**/index.html' -dry # dry run, multiple ignores
Command line options
shorthand | long form | description |
---|---|---|
-dry | --dry-run | run without any changes. |
-e | --exclude | Files that will be ignored. |