Package: nested-rimraf
nested-rimrafNested rimraf CLI app.Use it to clear your junk in nested directories
Looks for target file/directory through specified tree and then removes everythingPracticeImaginary folder structure:/subject→/file→/node_modules//file,notdirectory→/node_modules→/enemy.txt→/sub→/2→/1→/4→/node_modules→/enemy.txt→/3→/node_modules→/enemy.txt→/sub2→/node_modules→/enemy.txt→/symlink→/example→/enemy.txt→/node_modules//symlinkto/subject/symlink/exampleTasks:Find allnode_modulesFind and remove allnode_modulesFind and remove alldirectoriesnamednode_modulesFind and remove allnode_modules, but do not remove symlinks[Ultimate]Find allnode_modules, except files and symlinks, save them to file, correct file and remove the
remaining1. Find allnode_modulesWe need to runscancommand withtarget=node_modulesanddirectory=./subject$>nested-rimrafscannode_modules./subject

Filesanddirectories(includesymlinks):→subject/node_modules→subject/symlink/node_modules→subject/file/node_modules→subject/sub/node_modules→subject/sub/3/node_modules→subject/sub/2/1/4/node_modules→subject/sub2/node_modules2. Find and remove allnode_modulesAs easy, as previous one. Just userminstead ofscan$>nested-rimrafrmnode_modules./subject

Filesanddirectories(includesymlinks):→subject/node_modules→subject/symlink/node_modules→subject/file/node_modules→subject/sub/node_modules→subject/sub/3/node_modules→subject/sub/2/1/4/node_modules→subject/sub2/node_modules
Areyousureyouwanttodeleteit?[y/N]:y
Doneflawlessly!Note:QuestionAre you sure you want to delete it? [y/N]: ymay be avoided with--agree/-yoption. Like that:$>nested-rimrafrm-ynode_modules./subject

Filesanddirectories(includesymlinks):→subject/node_modules→subject/symlink/node_modules→subject/file/node_modules→subject/sub/node_modules→subject/sub/3/node_modules→subject/sub/2/1/4/node_modules→subject/sub2/node_modules
Doneflawlessly!3. Find and remove alldirectoriesnamednode_modulesOk, lets add option--dir-only/-d$>nested-rimrafrm-ynode_modules./subject--dir-onlyDirectories(includesymlinks):→subject/node_modules→subject/symlink/node_modules→subject/sub/node_modules→subject/sub/3/node_modules→subject/sub/2/1/4/node_modules→subject/sub2/node_modules
Doneflawlessly!As you can see, there is nosubject/file/node_modulesin the list (because it's file, not a directory).Let's run something similar4. Find and remove allnode_modules, but do not remove symlinksSame pattern:$>nested-rimrafrm-ynode_modules./subject--without-symlinks

Directories(includesymlinks):→subject/node_modules→subject/file/node_modules→subject/sub/node_modules→subject/sub/3/node_modules→subject/sub/2/1/4/node_modules→subject/sub2/node_modules
Doneflawlessly!Let's try the hardest one, shall we?5.[Ultimate]Find allnode_modules, except files and symlinks, save them to file, correct file and remove theremainingHuman control, eh?$>nested-rimrafscan-dsLnode_modules./subject--save-path./subject/to_correct.txtDirectories(excludesymlinks):→subject/node_modules→subject/sub/node_modules→subject/sub/3/node_modules→subject/sub/2/1/4/node_modules→subject/sub2/node_modules
Successfullysavedlistto"subject/to_correct.txt"A lot of params:-d- same as--dir-only. Includes only directories-s- same as--without-symlinks.  Excludes symlinks-L- same as--save-list. Saves list of matches to file--save-path- path to save matchesWhat does this file contain? Nothing special, just list of files$>cat./subject/to_correct.txt

subject/node_modules
subject/sub/node_modules
subject/sub/3/node_modules
subject/sub/2/1/4/node_modules
subject/sub2/node_modulesLet's take it easy and savesubject/sub/node_modulesby removing it from the file.And, 3, 2, 1, clear!$>nested-rimrafrmf-yds./subject/to_correct.txt

Directories(encludesymlinks):→subject/node_modules→subject/sub/3/node_modules→subject/sub/2/1/4/node_modules→subject/sub2/node_modules
Doneflawlessly!Good job!Usage:$nested-rimraf[OPTIONS]COMMAND[ARGS]...Options:--install-completion: Install completion for the current shell.--show-completion: Show completion for the current shell, to copy it or customize the installation.--help: Show this message and exit.Commands:rm: Scan and remove targets inside directory and...rmf: Took file, generated by "nested-rimraf scan"...scan: Scan directory and child-directories to find...nested-rimraf rmScan and remove targets inside directory and sub-directoriesUsage:$nested-rimrafrm[OPTIONS]TARGET[DIRECTORY]Arguments:TARGET: Target name to find inside of directory  [required][DIRECTORY]: Directory to scan in  [default: .]Options:-d, --dir-only: Target only directories  [default: False]-s, --without-symlinks: Do not process symlinks as targets  [default: False]-y, --agree: Remove without any questions  [default: False]-I, --ignore-errors: Ignore errors and delete until possible  [default: False]-v, --verbose: Talk a lot  [default: False]--help: Show this message and exit.nested-rimraf rmfTook file, generated by "nested-rimraf scan" and remove everything from itUsage:$nested-rimrafrmf[OPTIONS][SAVE_PATH]Arguments:[SAVE_PATH]: Remove list from passed file or ".nr-todo" inside passed directory  [default: .nr-todo]Options:-d, --dir-only: Target only directories  [default: False]-s, --without-symlinks: Do not process symlinks as targets  [default: False]-y, --agree: Remove without any questions  [default: False]-I, --ignore-errors: Ignore errors and delete until possible  [default: False]-v, --verbose: Talk a lot  [default: False]--help: Show this message and exit.nested-rimraf scanScan directory and child-directories to find targetsUsage:nested-rimraf scanUsage:$nested-rimrafscan[OPTIONS]TARGET[DIRECTORY]Arguments:TARGET: Target name to find inside of directory  [required][DIRECTORY]: Directory to scan in  [default: .]Options:-d, --dir-only: Target only directories  [default: False]-s, --without-symlinks: Do not process symlinks as targets  [default: False]-L, --save-list: Save list of targets for further use  [default: False]--save-path TEXT: File to save list of targets  [default: .nr-todo]-v, --verbose: Talk a lot  [default: False]--help: Show this message and exit.