I often have to copy a large number of files and folders with the base code and replace various lines inside the files, as well as in the names of files and folders, and this takes a lot of time 😢.
To solve this problem, I wrote a utility that can do it for me 😎.
Links
https://www.npmjs.com/package/rucken - npm package
https://github.com/rucken/rucken/blob/develop/libs/rucken/src/lib/copy-paste/copy-paste.service.ts - source code
https://www.npmjs.com/package/case-anything - main library used
Example of usage
1) Create folder cat-dog
mkdir cat-dog
2) Create txt file cat-dog/cat_dog.txt
echo "catDog
CatDog
cat-dog
cat_dog
CAT_DOG
Cat-Dog
Cat_Dog
CAT-DOG
cat Dog
Cat Dog
cat dog
CAT DOG
catDogs
CatDogs
cat-dogs
cat_dogs
CAT_DOGS
Cat-Dogs
Cat_Dogs
CAT-DOGS
cat Dogs
Cat Dogs
cat dogs
CAT DOGS" > cat-dog/cat_dog.txt
3) Run the utility
npx rucken copy-paste --find=cat-dog --replace=human-ufo --path=./cat-dog
4) Check new file
echo ./human-ufo/human_ufo.txt
Result
humanUfo
HumanUfo
human-ufo
human_ufo
HUMAN_UFO
Human-Ufo
Human_Ufo
HUMAN-UFO
human Ufo
Human Ufo
human ufo
HUMAN UFO
humanUfos
HumanUfos
human-ufos
human_ufos
HUMAN_UFOS
Human-Ufos
Human_Ufos
HUMAN-UFOS
human Ufos
Human Ufos
human ufos
HUMAN UFOS
If you can’t run it through npx, then you need to install the utility globally
Install
npm i -g rucken
Usage
rucken copy-paste --find=cat-dog --replace=human-ufo --path=./cat-dog
I hope this utility will help developers save time 😉
Top comments (0)