bulletmark / edir

Program to rename, remove, and copy files and directories using your editor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow cross-device (cross-filesystem) moving

denilsonsa opened this issue · comments

If I try to move a file from one mount point to another, I get this error message:

Traceback (most recent call last):
  File "/usr/bin/edir", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.11/site-packages/edir.py", line 481, in main
    p.rename_temp()
  File "/usr/lib/python3.11/site-packages/edir.py", line 180, in rename_temp
    rename(self.path, self.temppath, self.is_git)
  File "/usr/lib/python3.11/site-packages/edir.py", line 123, in rename
    pathsrc.replace(pathdest)
  File "/usr/lib/python3.11/pathlib.py", line 1188, in replace
    os.replace(self, target)
OSError: [Errno 18] Invalid cross-device link: '/home/denilson/Downloads/FOOBAR' -> '.tmp-edir/FOOBAR'

Example real-world use-case:

  1. Download a bunch of files to ~/Downloads/. Or think about having a USB drive that is mounted.
  2. Use edir or vidir to move (and possible rename while moving) files from one location to either the hard drive or to an SMB-mounted network storage.
    • By "rename while moving" I mean changing from ~/Downloads/IMG_20230102030405.JPG to /mnt/nas/photos/Party-001.jpg.
  3. It fails. :(

This issue is also present in vidir. (Although I haven't reported it there. Maybe I should — But where is the official vidir repository/project page?).

Bonus issue: when that error happens, it leaves behind an empty .tmp-edir/ directory.

Fixed by commit 621088f, new release 2.19.

Awesome!

You may also want to add this feature to the README, as the 27th improvement.