tfeldmann / organize

The file management automation tool.
http://organize.readthedocs.io
MIT License
2.27k stars 129 forks source link

Include multiple actions and mix move and shell crashes organize-tool #372

Closed hum4nizer closed 6 months ago

hum4nizer commented 6 months ago

Describe the bug Include multiple actions in rule and mix the actions "move" and "shell" crashes organize-tool

Screenshots raceback (most recent call last): File "/usr/lib/python3.11/site-packages/organize/rule.py", line 288, in execute for action in action_pipeline( File "/usr/lib/python3.11/site-packages/organize/rule.py", line 101, in action_pipeline action.pipeline(res=res, simulate=simulate, output=output) File "/usr/lib/python3.11/site-packages/organize/actions/shell.py", line 55, in pipeline full_cmd = render(self._cmd, res.dict()) ^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/organize/resource.py", line 54, in dict relative_path=self.relative_path(), ^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/organize/resource.py", line 47, in relative_path return self.path.relative_to(self.basedir) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/pathlib.py", line 730, in relative_to raise ValueError("{!r} is not in the subpath of {!r}" ValueError: FILEPATH FILENAME is not in the subpath of FILEPATH OR one path is relative and the other is absolute. During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/bin/organize", line 8, in sys.exit(cli()) ^^^^^ File "/usr/lib/python3.11/site-packages/organize/cli.py", line 286, in cli _execute(simulate=False) File "/usr/lib/python3.11/site-packages/organize/cli.py", line 146, in execute ).execute( ^^^^^^^^ File "/usr/lib/python3.11/site-packages/organize/config.py", line 105, in execute rule_summary = rule.execute( ^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/organize/rule.py", line 298, in execute output.msg( File "/usr/lib/python3.11/site-packages/organize/output/default.py", line 175, in msg self.show_resource(res) File "/usr/lib/python3.11/site-packages/organize/output/default.py", line 123, in show_resource relative_path = res.relative_path() ^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/organize/resource.py", line 47, in relative_path return self.path.relative_to(self.basedir) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Environment (please complete the following information):

Your config file

rules:
  - locations: /mnt/storage01/files/finished/
    subfolders: True
    filters:
      - extension: 
        - .pdf
        - .docx
      - name:
          startswith:
            - Project
          contains:
            - Enigma
          case_sensitive: False
    actions:
      - move: '/mnt/storage01/Projects/Project Enigma/'
      - shell: 'logwriter logfile=/var/log/project.log message="Moved file {path.stem} to project directory"'
tfeldmann commented 6 months ago

Thank you for reporting!

tfeldmann commented 6 months ago

This is fixed in the new version.

hum4nizer commented 6 months ago

Thank you so much for a wonderful project!