diff --git a/brename.py b/brename.py index 970d805..7128a9e 100644 --- a/brename.py +++ b/brename.py @@ -115,7 +115,7 @@ def loop(pairs, dry=False): line = f'{old.absolute_path}\n{new.absolute_path}\n' safeprint.safeprint(line) else: - os.rename(old.absolute_path, new.absolute_path) + os.rename(old, new) def brename_argparse(args): return brename( diff --git a/delete.py b/delete.py index add5c2d..98568e5 100644 --- a/delete.py +++ b/delete.py @@ -9,10 +9,10 @@ def main(argv): for path in pathclass.glob_many(pipeable.go(argv, skip_blank=True)): if path.is_file: pipeable.stdout(path.absolute_path) - os.remove(path.absolute_path) + os.remove(path) elif path.is_dir: pipeable.stdout(path.absolute_path) - shutil.rmtree(path.absolute_path) + shutil.rmtree(path) return 0 if __name__ == '__main__': diff --git a/filenameorderedrandomness.pyw b/filenameorderedrandomness.pyw index b6e1c08..3d2d5f7 100644 --- a/filenameorderedrandomness.pyw +++ b/filenameorderedrandomness.pyw @@ -21,5 +21,5 @@ for path in pathclass.glob_many(argv): newname = str(randname).rjust(12, '0') + path.dot_extension randname += 1 newname = path.parent.with_child(newname) - os.rename(path.absolute_path, newname.absolute_path) + os.rename(path, newname) print('%s -> %s' % (path.absolute_path, newname.basename)) diff --git a/filenamescramble.py b/filenamescramble.py index 9002615..5a938c4 100644 --- a/filenamescramble.py +++ b/filenamescramble.py @@ -16,5 +16,5 @@ for path in pathclass.glob_many(argv): newname = [random.choice(string.ascii_lowercase) for x in range(9)] newname = ''.join(newname) + path.dot_extension newname = path.parent.with_child(newname) - os.rename(path.absolute_path, newname.absolute_path) + os.rename(path, newname) print('%s -> %s' % (path.absolute_path, newname.basename)) diff --git a/filenamescrambleint.py b/filenamescrambleint.py index f241d38..1ce3f6f 100644 --- a/filenamescrambleint.py +++ b/filenamescrambleint.py @@ -16,5 +16,5 @@ for path in pathclass.glob_many(argv): newname = [random.choice(string.digits) for x in range(12)] newname = ''.join(newname) + path.dot_extension newname = path.parent.with_child(newname) - os.rename(path.absolute_path, newname.absolute_path) + os.rename(path, newname) print('%s -> %s' % (path.absolute_path, newname.basename)) diff --git a/filepull.py b/filepull.py index 2292e49..e19bf8c 100644 --- a/filepull.py +++ b/filepull.py @@ -38,7 +38,7 @@ def filepull(pull_from='.', autoyes=False): if autoyes or interactive.getpermission(f'Move {len(files)} files?'): for f in files: local = os.path.join('.', f.basename) - os.rename(f.absolute_path, local) + os.rename(f, local) def filepull_argparse(args): filepull(pull_from=args.pull_from, autoyes=args.autoyes) diff --git a/inputrename.py b/inputrename.py index bdb992d..40c287c 100644 --- a/inputrename.py +++ b/inputrename.py @@ -24,7 +24,7 @@ def inputrename_argparse(args): if this: new_name = file.basename.replace(args.keyword, this) new_name = file.parent.with_child(new_name) - os.rename(file.absolute_path, new_name.absolute_path) + os.rename(file, new_name) prev = this return 0 diff --git a/recycle.py b/recycle.py index af4cb2e..5685b53 100644 --- a/recycle.py +++ b/recycle.py @@ -7,7 +7,7 @@ from voussoirkit import pipeable def main(argv): for path in pathclass.glob_many(pipeable.go(argv, skip_blank=True)): pipeable.stdout(path.absolute_path) - send2trash.send2trash(path.absolute_path) + send2trash.send2trash(path) return 0 if __name__ == '__main__': diff --git a/sole_subdir_lift.py b/sole_subdir_lift.py index 93ad8f9..c5886b1 100644 --- a/sole_subdir_lift.py +++ b/sole_subdir_lift.py @@ -43,14 +43,14 @@ def sole_lift_argparse(args): # to lift don't have name conflicts with the child dir itself. # Consider .\abc\abc where the grandchild can't be moved. temp_dir = directory.with_child(passwordy.urandom_hex(32)) - os.rename(child.absolute_path, temp_dir.absolute_path) + os.rename(child, temp_dir) for grandchild in temp_dir.listdir(): - shutil.move(grandchild.absolute_path, directory.absolute_path) + shutil.move(grandchild, directory) if temp_dir.listdir(): raise Exception() - os.rmdir(temp_dir.absolute_path) + os.rmdir(temp_dir) queue.append(directory.parent) return 0