remove-item <path...> [options]
One or more file or directory paths can be specified.
Flag
Description
-r, --recursive
Remove directories and their contents
-f, --force
Ignore missing files and continue on err
-v, --verbose
Print detailed operation logs
-q, --quiet
Suppress all non-error output
-i, --interactive
Prompt before each removal
--dry-run
Show what would be deleted without doing
--include <pattern>
Only remove paths matching pattern (repeatable, comma-separated)
--exclude <pattern>
Skip paths matching pattern (repeatable, comma-separated)
--max-depth <n>
Limit recursion depth
--allow-root
Allow removing root directory (/ or C:\)
-h, --help
Display help text and exit
Code
Meaning
0
All paths removed successfully
1
One or more paths failed, or no args given
remove-item file1.txt file2.txt file3.txt
remove-item dist --recursive
remove-item node_modules --recursive --force
remove-item dist --dry-run
Preview with verbose logging
remove-item temp --dry-run --verbose
remove-item dist coverage .cache --recursive --force
Remove with glob patterns
remove-item " *.tmp" --force
Remove only matching files
remove-item src --recursive --include " *.ts"
remove-item build --recursive --include " *.js,*.css"
remove-item . --recursive --exclude " node_modules"
remove-item dist --recursive --exclude " *.map"
remove-item cache --recursive --force --quiet
remove-item dist --recursive --interactive
remove-item node_modules --recursive --max-depth 2
remove-item / --recursive --force --allow-root