Simple CLI to delete files from a folder
delfiles.py
is the main script that needs to be built.
-
- python >= 3.8
- latest pyinstaller
- After necessary installations, navigate to the project directory in the terminal with
delfiles.py
. - Type the command
pyinstaller --one-file delfiles.py
, you can set custom flags referring to the docs. - This command will create 2 directories,
build
&dist
delfiles.exe
can be found indist
, you can take this app and distribute to wherever you like. Also this is our CLI
The application comes with 4
flags.
-h
to display help--folder
or-F
, to specify the path of your directory where deletable files are presented.--dictionary
or-D
, to specify the path of the.txt
file which contains the possible matches of the file names, that needs to be deleted or preserved.--exclude
or-E
, doesn't take arguments, but if addeddelfiles
will skip all the files that has a name matching with any of the strings provided in the--dictionary
. If not added then the files whose name matches with the names provided in the--dictionary
file WILL be deleted.
--folder
and--dictionary
takes both absolute and relative paths.- The strings in
--dictionary
files "should" be seperated with a new line
delfiles --folder "./sample" --dictionary "dict.txt" --exclude
This deletes all the files in sample
directory with names that doesn't match with any strings given on dict.txt
A createfiles.py
can be used to create randomly generated files for you to delete, default is 30. You can edit the code as per your testing needs.
Feel free to download and mess around. Even create a PR. Have fun coding !!!