Remove files/folders. Not drop-in replacement for rm, though
Project description
Remove
- removes files
- prints out filepath
- logs filepath to syslog/sqlite
Motivation
- being able to clean up folders deep inside tree, like:
remove **/node_nodules - have some persistent logging on what being removed: in journald/syslog and in sqlite database
- get list of files to remove: from file
- get list of files to remove: from command
Alternative: rm -rf **/node_nodules
- Yes
- However we would not see what entries being removed
Alternative: rm -rfv **/node_nodules
- Yes
- But
rmwould log each file (insidenode_modules) in this case. - For a large
node_modules- the output is overwhelming. I just need to see which node_modules being removed and keep the output log readable.
Alternative:find and xargs
- Yes
- But we will end up with rather longer command for a
trivialtask
Alternative: find . -type d -name node_modules -prune -print -exec rm -fr {} \;
- Yes, it does work!
- Again, explaining commands like this would take some effort.
- Or, running commands like this, without fully understanding it - is a risky habit
Example
pip install ngm-remove
cd projects
remove **/node_nodules
journalctl -t remove -r
Use in scripts
- In scripts, you might need to use
shopt -s globstarto enable**globs
shopt -s globstar # feature available since bash 4.0, released in 2009
remove **/node_modules
Remove files of certain type
find . -type f -exec file {} \; | grep -i --color=never avif > files.txt
remove --input files.txt
Options
remove file1 file2 # Remove file1 and file2
remove --help # Show help
remove --version # Show version
remove --input list.txt # Get paths from list.txt and remove those
remove --cmd 'cat list.txt' # Get paths from running command and remove those
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ngm_remove-0.0.10.tar.gz
(6.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ngm_remove-0.0.10.tar.gz.
File metadata
- Download URL: ngm_remove-0.0.10.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16115e70d13bd4131f828b53f889e0079cdba135c306211a12be765ede82c0f0
|
|
| MD5 |
b25f33b14ca3885199398e287f28b3f0
|
|
| BLAKE2b-256 |
1fb3b07792d4b9e812882c0570bb53803d78e5ab0ad36333aabcd4b2ccb5e43b
|
File details
Details for the file ngm_remove-0.0.10-py3-none-any.whl.
File metadata
- Download URL: ngm_remove-0.0.10-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7fb54b1b62f9cfc041ef700a823f8827ed3b557b90988acc303fbd6887d67c7
|
|
| MD5 |
b8466efb02663a1d80f97732e178694d
|
|
| BLAKE2b-256 |
5a134c75a4c1cdb6c644fcedeedc66e983339341018c10173cdd1c21ae2927d4
|