Skip to content

jensrot/move-files

Repository files navigation

move-files

A CLI that watches a folder and automatically moves incoming files to destination folders based on their extension. Works on macOS, Linux, and Windows.

Useful with Syncthing or LocalSend to auto-move files received from your phone.

Install

macOS / Linux

curl -fsSL https://raw.githubusercontent.com/jensrot/move-files/main/install.sh | bash

If move-files is not found after install, add this to your ~/.zshrc or ~/.bashrc:

export PATH="$HOME/.local/bin:$PATH"

Windows (PowerShell)

Invoke-WebRequest -Uri https://raw.githubusercontent.com/jensrot/move-files/main/install.ps1 -OutFile install.ps1
powershell -ExecutionPolicy Bypass -File install.ps1

Requires Python 3.10+. Both installers create an isolated virtual environment — no sudo or admin rights needed.

Usage

move-files                   # interactive menu
move-files --dry-run         # preview what would be moved
move-files sync              # move all files in the input folder once
move-files watch             # auto-move files as they arrive
move-files watch -i <dir>    # watch a specific folder
move-files return            # move files back to the input folder

Routing rules

Edit INPUT_FOLDER, OUTPUT_FOLDERS, and FALLBACK_FOLDER at the top of move-files.py to change where file types go:

INPUT_FOLDER = "~/Downloads/phone"

OUTPUT_FOLDERS = {
    ".jpg":  "~/Pictures/phone",
    ".jpeg": "~/Pictures/phone",
    ".png":  "~/Pictures/phone",
    ".gif":  "~/Pictures/phone",
    ".heic": "~/Pictures/phone",
    ".mp4":  "~/Movies/phone",
    ".mov":  "~/Movies/phone",
    ".pdf":  "~/Documents/phone",
    ".txt":  "~/notes_phone",
}

FALLBACK_FOLDER = "~/Downloads/moved"

Getting files from your phone

Syncthing (recommended — fully automatic)

Install Syncthing on your computer:

Platform Command
macOS brew install syncthing && brew services start syncthing
Linux sudo apt install syncthing && syncthing &
Windows Download from syncthing.net and run

Then:

  1. Open http://127.0.0.1:8384 and install Syncthing on Android (Play Store)
  2. Link devices and share a folder from Android to ~/Downloads/phone
  3. Run move-files watch -i ~/Downloads/phone

Files sync automatically over WiFi — no manual steps after setup.

LocalSend (manual send each time)

Install LocalSend on your computer:

Platform Command
macOS brew install --cask localsend
Linux Download the .AppImage from localsend.org
Windows winget install localsend.localsend

Then:

  1. Install LocalSend on Android (Play Store)
  2. Both devices on the same WiFi, both apps open
  3. Share any file → LocalSend → pick your computer
  4. Run move-files to move what arrived

Development

pip install -r requirements-dev.txt
pytest tests/ -v

Requirements

  • macOS, Linux, or Windows
  • Python 3.10+
  • click (installed automatically)

About

CLI that watches a folder and automatically moves incoming files to destination folders based on their extension. Works on macOS, Linux, and Windows.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors