{"id":19747777,"url":"https://github.com/haasr/files-organizer","last_synced_at":"2025-10-11T13:02:41.553Z","repository":{"id":139641548,"uuid":"590692734","full_name":"haasr/files-organizer","owner":"haasr","description":"Python script to automagically sort your files according to their extensions.","archived":false,"fork":false,"pushed_at":"2024-06-14T00:25:11.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-23T22:14:25.711Z","etag":null,"topics":["automated","automation","document-management","file-management","files","filesystem","organization","productivity","python","python-3","python3","watchdog"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haasr.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-19T01:12:11.000Z","updated_at":"2024-06-14T00:41:11.000Z","dependencies_parsed_at":"2024-02-19T20:18:57.377Z","dependency_job_id":null,"html_url":"https://github.com/haasr/files-organizer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haasr%2Ffiles-organizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haasr%2Ffiles-organizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haasr%2Ffiles-organizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haasr%2Ffiles-organizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haasr","download_url":"https://codeload.github.com/haasr/files-organizer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241078491,"owners_count":19905867,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automated","automation","document-management","file-management","files","filesystem","organization","productivity","python","python-3","python3","watchdog"],"created_at":"2024-11-12T02:18:52.208Z","updated_at":"2025-10-11T13:02:41.480Z","avatar_url":"https://github.com/haasr.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"****************\nfiles-organizer\n****************\n\nPython script to automagically sort your files according to their extensions.\n\n\n.. contents:: Contents\n\n\nChanges (6/13/2024)\n###################\n\n- Added logging options and incorporated basic INFO logging.\n- Logging exception that may occur if user manually moves file at precisely the same time the program tries to.\n- Added a few more audio extensions and the HEIC image extension to the default extensions map.\n- Increased sleep time before file is moved from 1s to 2s.\n\n\nRequirements\n############\n\n- Computer with Python 3.6+ installed\n\nSetup\n#####\n\n\nNote that if ``python`` is used in a code block, you may have to substitute it for ``python3``\nor ``py`` depending on your configuration. ``pip`` may also have to be substituted for ``pip3``.\n\n\n1) Specify Your Path Prefix and username\n----------------------------------------\n\nIn ``config.py``, uncomment the path prefix that matches your operating system. Comment out the other\npath prefixes. Then replace 'User' with your computer's account username.\n\n\n2) Customize which files get moved where\n----------------------------------------\n\nMy default configuration in ``config.py`` is for my personal preferences. I listen for changes in both\nmy Downloads folder and my Desktop folder. If, for example, you do not wish to automatically sort files\nin your Desktop folder, remove the second key-value pair in ``DIRECTORIES_MAP``.\n\n``EXTENSIONS_MAP`` categorizes lists of extensions to check for. The lists are by no means\ncomprehensive. I just included the extensions that I expect to see often. You may, of course, alter\nthe categories (the keys) and the lists of extensions. Just ensure that all the categories used in\n``DIRECTORIES_MAP`` are included as keys in ``EXTENSIONS_MAP`` to avert ``app.py`` from throwing a\n``KeyError``. \n\nYou can write as many key-value pairs as you like provided that you follow my format where each key in\n``DIRECTORIES_MAP`` is a directory to monitor and the key's value is itself a dictionary listing the category\nof files (which must be included as a key in ``EXTENSIONS_MAP``) and the directory to move such files.\n\n\n3) Install the required packages\n--------------------------------\n\nFrom the root directory for this project, install the dependencies as such:\n\n.. code:: powershell\n\n    pip install -r requirements.txt\n\n\nIf you wish, you may create and install the required packages to a virtual environment instead:\n\n(Powershell)\n\n.. code:: powershell\n\n    python -m venv venv\n    .\\venv\\Scripts\\activate\n    pip install -r requirements.txt\n\n(Linux)\n\n.. code:: bash\n\n    python3 -m venv venv\n    source venv/bin/activate\n    pip3 install -r requirements.txt\n\n\n4) Configure ``files-organizer`` to Start Automagically\n-------------------------------------------------------\n\nMac:\n====\n\nIf you're using a Mac, you are going to have to figure this part out for yourself. I don't give a shit about\nyour Mac or your reasoning for why you use it. Apparently since some time in 2005 macOS uses an OS management\ndaemon called ``launchd``. You could try to write a ``launchd`` file in the form of a disturbingly verbose\nplist XML script `like this \u003chttps://davidhamann.de/2018/03/13/setting-up-a-launchagent-macos-cron/\u003e`_.\n\nWindows:\n========\n\nIn the ``system_scripts/Windows`` folder, I have created a one-line VB script to execute this project. simply\nchange the path to wherever the ``app.py`` file is located in your filesystem. Then copy the file into\n``C:\\Users\\\u003cUser\u003e\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup``. To execute this program right\naway, launch the ``Run dialog`` (Win + R), type \"shell:startup\" to open the startup folder, and double click on\nthe ``filesorganizer`` VB script.\n\nLinux (with systemd):\n=====================\n\nIf you're on Github *and* you use Linux, you probably don't need any help :D. Anyhow, I've created a ``start.bash``\nscript to work for the ``systemd`` service file in ``system_scripts/Linux`` to call on. I did that to simplify the\nconfiguration if you wish to use a Python virtual environment for this project. If you are using a virtual environment\nfor this project, see where I have commented about inserting a command for activating your virtual environment in\n``start.bash``.\n\nOf course, if you are not using a virtual environment and for whatever reason it peaves you that ``systemd`` will be\nindirectly invoking Python through the ``start.bash`` script, you can change the ExecStart line in\n``system_scripts/Linux/filesorganizer.service`` to something like ``ExecStart=/usr/bin/python3 /home/\u003cusername\u003e/files-organizer/app.py``\nand just delete the start.bash script.\n\nEnsure that you have edited the paths in ``start.bash`` and ``filesorganizer.service`` and that the bash script is\nexecutable. Then copy the service file to ``/etc/systemd/system/``. Start and enable the service. Ex.:\n\n.. code:: bash\n\n    sudo cp /home/pi/files-organizer/system_scripts/Linux/filesorganizer.service /etc/systemd/system/\n    sudo systemctl start filesorganizer\n    sudo systemctl enable filesorganizer\n\n\n| To check the status of the service and debug, use:\n|  ``systemctl status filesorganizer``, and\n|  ``sudo journalctl -u filesorganizer|tail -f``\n\n\nUse Recursion\n#############\n\nThe last line of code in ``config.py``, ``OBSERVER_RECURSIVE = False``\nmeans that the Observer will not traverse any subdirectories for changes.\nToggle that to true if you wish to listen for changes in subdirectories\nas well.\n\nLogged output\n#############\n\nLogging settings are also configurable in ``config.py``. Unless you specify a path prefix in ``LOG_FILE_PATH``, the log file\nwill be stored in the program's working directory. E.g., if the program were invoked from a VB script in your startup folder,\nyou would find the log file in that folder.\n\nIf you notice that files are no longer being automagically moved as expected, check the log. If you identify bugs, please start\nan issue in this repo, sharing the relevant log information, and your platform. Or if you've patched a bug, please reach out to\nme or send a pull request!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaasr%2Ffiles-organizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaasr%2Ffiles-organizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaasr%2Ffiles-organizer/lists"}