# Deletes files (hardcore mode - Windows only)
### Recursive deletion:
The function can recursively delete files and directories, ensuring that
all nested files within a given path are removed.
### Dry run option (enabled by default!!):
The dryrun argument allows users to preview the files that would be deleted without actually performing the deletion.
This can help verify the list of files before proceeding
with the actual deletion.
### Print files option (enabled by default - can't be disabled when running with dryrun):
The print_files argument enables users to see the files and directories being deleted.
This can be useful for logging or providing feedback during the deletion process.
### pendmoves.exe to delete everything:
When dealing with stubborn files that cannot be deleted through normal means,
PendMoves https://learn.microsoft.com/en-us/sysinternals/downloads/pendmoves helps in cleaning up such files effectively.
It ensures that unwanted files are eventually removed (next reboot),
preventing them from occupying unnecessary disk space
or causing conflicts in the system.
### Integration and customization:
The function can be easily integrated into existing scripts or applications.
The arguments provide flexibility to customize the deletion process based
on specific requirements. A compiled exe file is also available: https://github.com/hansalemaos/hcdel/raw/main/hcdel.exe
### In Python
```python
# For security reasons, dryrun is always enabled, and always prints all files that would be deleted!
from hcdel.hcdel import delallfiles
delallfiles(
path=r'C:\delfiles', dryrun = False, print_files = True
)
# Output
Deleting: C:\delfiles\xff1fdx.mkv
Deleting: C:\delfiles\xfffdx.mkv
Deleting: C:\delfiles\xfffxxxxxxxdxxx ddddddddd (2).mkv
Deleting: C:\delfiles\xfffxxxxxxxdxxx ddddddddd.mkv
Deleting: C:\delfiles\xffxxxxaaxdx.mkv
The following files will be deleted the next reboot: # i kept this file open in my media player
C:\delfiles\xfffxxxxxxxdxxx ddddddddd.mkv
```
### CLI
```
# For security reasons, dryrun is always enabled, and always prints all files that would be deleted!
# https://github.com/hansalemaos/hcdel/raw/main/hcdel.exe
hcdel.exe --path "C:\delfiles" --dryrun 0 --print_files 1
```
# Arguments
```python
delallfiles(
path: str | None = None, dryrun: int | bool = 1, print_files: int | bool = 1
):
r"""
Recursively deletes files and directories.
Args:
path (str | None, optional): The path to the directory or file to be deleted. If None or '', the script exits with code 1. Defaults to None.
dryrun (int | bool, optional): If set to 1 or True, performs a dry run and only prints the files that would be deleted without actually deleting them. If set to 0 or False, deletes the files and directories. Defaults to 1.
print_files (int | bool, optional): If set to 1 or True, prints the files and directories being deleted. Defaults to 1.
Returns:
None
Raises:
None
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/hcdel",
"name": "hcdel",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "pendmoves,delete,files",
"author": "Johannes Fischer",
"author_email": "aulasparticularesdealemaosp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/98/19/bd32bfc5a09cdaaaba07a914ddc8914fb937f843a8e2b3b78b2c692cf8e2/hcdel-0.10.tar.gz",
"platform": null,
"description": "\r\n# Deletes files (hardcore mode - Windows only)\r\n\r\n### Recursive deletion: \r\n\r\nThe function can recursively delete files and directories, ensuring that\r\n all nested files within a given path are removed.\r\n\r\n### Dry run option (enabled by default!!): \r\n\r\nThe dryrun argument allows users to preview the files that would be deleted without actually performing the deletion.\r\nThis can help verify the list of files before proceeding \r\nwith the actual deletion.\r\n\r\n### Print files option (enabled by default - can't be disabled when running with dryrun): \r\n\r\nThe print_files argument enables users to see the files and directories being deleted. \r\nThis can be useful for logging or providing feedback during the deletion process.\r\n\r\n### pendmoves.exe to delete everything:\r\n\r\nWhen dealing with stubborn files that cannot be deleted through normal means, \r\nPendMoves https://learn.microsoft.com/en-us/sysinternals/downloads/pendmoves helps in cleaning up such files effectively. \r\nIt ensures that unwanted files are eventually removed (next reboot), \r\npreventing them from occupying unnecessary disk space \r\nor causing conflicts in the system.\r\n\r\n### Integration and customization: \r\n\r\nThe function can be easily integrated into existing scripts or applications. \r\nThe arguments provide flexibility to customize the deletion process based\r\n on specific requirements. A compiled exe file is also available: https://github.com/hansalemaos/hcdel/raw/main/hcdel.exe\r\n\r\n\r\n\r\n### In Python \r\n\r\n```python\r\n# For security reasons, dryrun is always enabled, and always prints all files that would be deleted!\r\nfrom hcdel.hcdel import delallfiles\r\ndelallfiles(\r\n path=r'C:\\delfiles', dryrun = False, print_files = True\r\n)\r\n\r\n# Output \r\n\r\nDeleting: C:\\delfiles\\xff1fdx.mkv\r\nDeleting: C:\\delfiles\\xfffdx.mkv\r\nDeleting: C:\\delfiles\\xfffxxxxxxxdxxx ddddddddd (2).mkv\r\nDeleting: C:\\delfiles\\xfffxxxxxxxdxxx ddddddddd.mkv\r\nDeleting: C:\\delfiles\\xffxxxxaaxdx.mkv\r\nThe following files will be deleted the next reboot: # i kept this file open in my media player \r\nC:\\delfiles\\xfffxxxxxxxdxxx ddddddddd.mkv\r\n\r\n```\r\n\r\n### CLI\r\n```\r\n# For security reasons, dryrun is always enabled, and always prints all files that would be deleted!\r\n# https://github.com/hansalemaos/hcdel/raw/main/hcdel.exe\r\n\r\nhcdel.exe --path \"C:\\delfiles\" --dryrun 0 --print_files 1\r\n\r\n```\r\n\r\n\r\n# Arguments \r\n\r\n```python\r\ndelallfiles(\r\n path: str | None = None, dryrun: int | bool = 1, print_files: int | bool = 1\r\n):\r\n r\"\"\"\r\n Recursively deletes files and directories.\r\n\r\n Args:\r\n path (str | None, optional): The path to the directory or file to be deleted. If None or '', the script exits with code 1. Defaults to None.\r\n dryrun (int | bool, optional): If set to 1 or True, performs a dry run and only prints the files that would be deleted without actually deleting them. If set to 0 or False, deletes the files and directories. Defaults to 1.\r\n print_files (int | bool, optional): If set to 1 or True, prints the files and directories being deleted. Defaults to 1.\r\n\r\n Returns:\r\n None\r\n\r\n Raises:\r\n None\r\n``` \r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Deletes files (hardcore mode - Windows only)",
"version": "0.10",
"project_urls": {
"Homepage": "https://github.com/hansalemaos/hcdel"
},
"split_keywords": [
"pendmoves",
"delete",
"files"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cd6a261d16e77dbf368b59d0dffa5d65cb669d2106276a37bd2c7e597e646f14",
"md5": "35d0a544e590cb5f111503dba4f1095c",
"sha256": "13b837b1126b57159808632868478ebdf7e935c0889605f9981e10a73c637d0b"
},
"downloads": -1,
"filename": "hcdel-0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "35d0a544e590cb5f111503dba4f1095c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 1019892,
"upload_time": "2023-06-12T04:12:14",
"upload_time_iso_8601": "2023-06-12T04:12:14.935643Z",
"url": "https://files.pythonhosted.org/packages/cd/6a/261d16e77dbf368b59d0dffa5d65cb669d2106276a37bd2c7e597e646f14/hcdel-0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9819bd32bfc5a09cdaaaba07a914ddc8914fb937f843a8e2b3b78b2c692cf8e2",
"md5": "cc2b3e90a3998f28ff94e191ca7008cf",
"sha256": "0e34159db406b1bb8e88af239f21125492bf2b17d8e7619a5c12338e027d0cff"
},
"downloads": -1,
"filename": "hcdel-0.10.tar.gz",
"has_sig": false,
"md5_digest": "cc2b3e90a3998f28ff94e191ca7008cf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 1019717,
"upload_time": "2023-06-12T04:12:20",
"upload_time_iso_8601": "2023-06-12T04:12:20.168981Z",
"url": "https://files.pythonhosted.org/packages/98/19/bd32bfc5a09cdaaaba07a914ddc8914fb937f843a8e2b3b78b2c692cf8e2/hcdel-0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-12 04:12:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hansalemaos",
"github_project": "hcdel",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "hcdel"
}