feat: trash files by default
This commit is contained in:
@@ -4,6 +4,7 @@ import os
|
||||
import pathlib
|
||||
|
||||
import requests
|
||||
import send2trash
|
||||
|
||||
WEBHOOK_URL = os.environ.get("RANDOM_FILE_PICKER_WEBHOOK_URL", None)
|
||||
MOVE_FOLDER = os.environ.get("RANDOM_FILE_PICKER_MOVE_FOLDER", None)
|
||||
@@ -111,3 +112,11 @@ def move_file_to_move_folder(file_path: pathlib.Path) -> None:
|
||||
destination_path = move_dir_path / f"{name}_{counter}{ext}"
|
||||
counter += 1
|
||||
_ = file_path.rename(destination_path)
|
||||
|
||||
def trash_file(file_path: pathlib.Path) -> None:
|
||||
"""
|
||||
Put the specified file into the system trash using the send2trash library.
|
||||
|
||||
:param file_path: The path of the file to be trashed.
|
||||
"""
|
||||
send2trash.send2trash(file_path)
|
||||
|
||||
Reference in New Issue
Block a user