April 29, 2021
developer productivity

Organize your computer ๐Ÿ—„

Target Users

If you use python and like having an organized computer – this article is for you ๐Ÿ‘‹๐Ÿฝ

The data ๐Ÿ’ฟ in your mac ๐Ÿ’ป is spread around into downloads, desktop, etc.There is a python ๐Ÿ tool organize-tool which can help you declutter and organize all your data with a simple YAML configuration.

The best part is that – you can also have python code in actions.

Thanks ๐Ÿ˜„ to tfeldmann for this awesome ๐Ÿ˜Ž tool

Installation: pip3 install -U organize-tool

๐Ÿ’ซ Github: https://github.com/tfeldmann/organize

๐Ÿ“š Docs: ReadTheDocs

๐Ÿš— Usage ๐Ÿ‘‹๐Ÿผ

rules:
    # move files to folder according to extension
    - folders:
        - ~/Downloads/**/*
        - ~/Desktop/**/*
      filters:
        - extension:
          - pdf
          - docx
          - jpg
          - pptx
          - xlsx
          - mov
          - mp4
          - m4a
          - png
          - heic
          - csv
          - jpeg
          - json
          - key
          - zip
      actions:
        - move: ~/Documents/{extension.upper}/
    # Move screenshots to a dir
    - folders: ~/Desktop
      filters:
        - filename:
            startswith: "Screen Shot"
      actions:
        - move: ~/Desktop/Screenshots/
    # remove empty files
    - folders:
          - ~/Downloads
          - ~/Desktop
      filters:
          - filesize: 0
      actions:
          - trash
    # remove partial downloads
    - folders: ~/Downloads
      filters:
          - extension:
                - download
                - crdownload
                - part
                - dmg
          - lastmodified:
                days: 2
                mode: older
      actions:
          - trash
    # remove duplicate files
    - folders:
        - ~/Desktop
        - ~/Downloads
        - ~/Documents
      subfolders: true
      filters:
        - duplicate
      actions:
        - echo: "{path} is a duplicate of {duplicate}"
        - trash

Let me know how used it in the comments below ๐Ÿ™‚

Cheers!