/my-configs

a dot files and other configuration files backup tool

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Backup And Manage All of My Configuration Files

Features I want to have

  • can specification where to backup the config files
  • backup current file and directory as list in configurations
  • convention over setting
  • link file to destination position link files in special directory to destination

File backup rename rules

  • /a/b/c absolute path file will be backup to _a-b/c
  • ~/.xx/yy directory in user home will be backup to ~+xx/yy
  • ~/xx/yy/zz directory in user home will be backup to ~xx-yy/zz
  • ~/.xx file will backup to xx.symlink
  • ~/.xx directory will backup to ~+xx.symlink

File link rules

  • every xx.symlink file will soft link into ~ directory
  • every ~+xx.symlink directory will soft link into ~ directory
  • every ~xx.symlink directory will soft link into ~ directory
  • every file and directory in directory with ~ prefix but not suffix with + will link to ~ directory
  • every file and directory in directory with _ prefix will link to absolute path

How to use this tool

  1. clone this repository
git clone https://github.com/alex-1q84/my-configs.git
  1. set where you want to back up your config files in the config.json, eg.
"backup_dir": "~/Dropbox/configs/"
  1. list all the files and directories in the config.json, eg.
  "paths": [
    "/usr/local/etc/shadowsocks-libev.json",
    "~/.gitconfig",
    "~/.config/fish",
    "~/.vimrc"
  ]

the final config.json file should look like as follows

{
  "backup_dir": "~/Dropbox/configs/",
  "paths": [
    "/usr/local/etc/shadowsocks-libev.json",
    "~/.gitconfig",
    "~/.config/fish",
    "~/.vimrc"
  ]
}
  1. run the my_configs.py script and you config files and directories will be backed up and linked back to original path
python3 my_configs.py