novoid / appendfilename

Intelligent appending text to file names, considering file extensions and file tags
GNU General Public License v3.0
50 stars 7 forks source link

renaming file which is a link to same file name doesn't work recursive #11

Open novoid opened 2 years ago

novoid commented 2 years ago

appendfilename should rename all linked "parent links" as long as the file name is the same. However, this seems to work only for the first link and not for all.

How to reproduce the issue

  1. create two nested TagTrees with https://github.com/novoid/filetags from files/* to tagtrees1/ and then from tagtrees1/tag/* to tagtrees2/ (all within the same parent directory)
    • this results in a file within tagtrees2/tag/foo -- tag.txt that points to tagtrees1/tag/foo -- tag.txt which points to files/foo -- tag.txt
      1. appendfilename -t "foobar" results in:
    • tagtrees2/tag/foo foobar -- tag.txt
    • tagtrees1/tag/foo foobar -- tag.txt
    • files/foo -- tag.txt <-- here, the renaming/recursion stops which is wrong. It should be: files/foo foobar -- tag.txt

Educated guess how to fix this

Adapt def handle_file_and_symlink_source_if_found(filename, text, dryrun) so that it works recursively just like filetags does with tags.