tfeldmann / organize

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

[v2.0.8] Symbolic links are not detected by `filters.name.startswith` #178

Open andreoliwa opened 2 years ago

andreoliwa commented 2 years ago

Rule:

rules:
  - name: "Echo .bash files on the root"
    locations: ~/
    filters:
      - name:
          startswith: .bash
    actions:
      - echo: "{name}"

Output:

❯ organize run
organize 2.0.8
Config: "/Users/aa/Library/Application Support/organize/config.yaml"

⚙ Echo .bash files on the root ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
/Users/aa
  .bash_history
    - (echo) .bash_history

My root files (.bash_history is an actual file, the others are symlinks):

❯ ls -1 ~/.bash*
/Users/aa/.bash_history
/Users/aa/.bash_profile -> /Users/aa/dotfiles/roles/bash/files/.bash_profile.sh
/Users/aa/.bashrc -> /Users/aa/dotfiles/roles/bash/files/.bashrc.sh
tfeldmann commented 2 years ago

Symbolic links are skipped at the moment. If this is something people are interested in I'll add a switch 👌

andreoliwa commented 2 years ago

I found a workaround, but I think it's nice to have.

Also, it's not mentioned on the docs: https://organize.readthedocs.io/en/latest/filters/#name

tfeldmann commented 2 years ago

I'm interest, how do you work around this?

It's not only the name filter, symlinks are always skipped

tfeldmann commented 2 years ago

I'm off the pc for today but I'll add symlink support in the next days

andreoliwa commented 2 years ago

I'm interest, how do you work around this?

Oh, nothing magical... I just used the file directly and avoided the symlinks. 😬

rules:
  - name: "Echo .bash files on the root"
    locations: ~/
    filters:
      - name: .bash_history
    actions:
      - echo: "{name}"
xdhmoore commented 2 years ago

I ran into a similar issue trying to move a file to a symlink of a folder on Win 10. Organize creates a new folder instead with the same name.