From e2a6236ec236fb6f6978db5b231cc7e807b842b4 Mon Sep 17 00:00:00 2001 From: Recolic <git@me.recolic.net> Date: Mon, 29 May 2023 08:09:30 -0700 Subject: [PATCH] add remove orphan prog --- remove-orphan-swddrw/main.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/remove-orphan-swddrw/main.py b/remove-orphan-swddrw/main.py index e4e4ac8..3c63f61 100644 --- a/remove-orphan-swddrw/main.py +++ b/remove-orphan-swddrw/main.py @@ -15,6 +15,8 @@ if os.name == 'nt': ######################################################################### import os, shutil +if os.name == 'nt': + from send2trash import send2trash def main(): print("DEBUG: workdir=", os.getcwd()) @@ -24,7 +26,7 @@ def main(): filesl = [f.lower() for f in os.listdir('.') if os.path.isfile(f)] for f in files: if is_drw(f): - print("CHECKING ", f) + #print("CHECKING ", f) ext_len = len('.slddrw') expecting1 = f[:-ext_len] + '.sldprt' @@ -35,11 +37,13 @@ def main(): else: # delete this file print("DELETE ", f) - os.remove(f) + if os.name == 'nt': + send2trash(f) + else: + os.remove(f) main() -input("按回车键退出") -- GitLab