From: Oleg Broytman Date: Wed, 20 Aug 2025 17:26:38 +0000 (+0300) Subject: Feat(mv): Check if the src/dst files exist X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=faf666a2cae43dbff1ed390bf05a84c25e7f30f6;p=xsetbg.git Feat(mv): Check if the src/dst files exist --- diff --git a/mv.py b/mv.py index 2fe2dd9..ce75590 100755 --- a/mv.py +++ b/mv.py @@ -25,6 +25,12 @@ try: except IndexError: usage(1) +if not os.path.exists(from_filename): + sys.exit("Filename %s does not exist" % from_filename) + +if os.path.exists(to_filename): + sys.exit("Filename %s already exists, cannot rename" % to_filename) + rows = list(xsetbg_db.selectBy(full_name=from_filename)) if not rows: sys.exit("No rows by filename %s" % from_filename)