2025-04-15 20:28:49 +02:00
2025-10-06 20:05:15 +02:00
2025-10-01 13:21:08 +02:00
2024-09-11 19:35:33 +02:00
2024-07-03 13:31:03 +02:00
2025-10-06 20:05:15 +02:00
2025-10-06 20:05:15 +02:00
2025-10-06 20:05:15 +02:00
2025-03-11 21:37:55 +01:00
2025-02-26 11:15:56 +01:00
2025-02-26 11:15:56 +01:00

synclib

A small Go tool for creating symbolic links

Created out of infuriating difficulty of creating symbolic links on windows

Instruction Formats

The tool supports two formats for defining symbolic links:

1. CSV Format (Legacy)

Simple comma-separated values with the format: <source>,<destination>[,force][,hard][,delete]

For example:

source_path,target_path
source_path,target_path,true
source_path,target_path,true,true
source_path,target_path,true,true,true

Or with named flags:

source_path,target_path,force=true,hard=true,delete=true
source_path,target_path,f=true,h=true,d=true

A more readable format using YAML:

links:
  - source: ~/Documents/config.ini
    target: ~/.config/app/config.ini
    force: true
  
  - source: ~/Pictures
    target: ~/Documents/Pictures
    hard: true
    force: true
  
  - source: ~/Scripts/script.sh
    target: ~/bin/script.sh
    delete: true

Alternatively, you can use an array directly:

- source: ~/Documents/config.ini
  target: ~/.config/app/config.ini
  force: true

- source: ~/Pictures
  target: ~/Documents/Pictures
  hard: true

Input Methods

The tool supports input of these instructions through:

  • Stdin
    • echo "this,that" | sync
  • Run arguments
    • sync this,that foo,bar "foo 2","C:/bar"
  • Files
    • sync -f <file> (CSV format)
    • sync -f <file.yaml> or sync -f <file.yml> (YAML format)
    • Where the file contains instructions, one per line for CSV or structured YAML
  • Directories
    • sync -r <directory>
    • This mode will look for "sync", "sync.yaml", or "sync.yml" files recursively in directories and run their instructions

Options

  • force: true - Overwrite an existing symbolic link at the target location
  • hard: true - Create a hard link instead of a symbolic link
  • delete: true - Delete a non-symlink file at the target location (implies force: true)

Use case

I have a lot of folders (documents, projects, configurations) backed up via Seafile and to have the software using those folders find them at their usual location I'm creating soft symbolic links from the seafile drive to their original location

It would be problematic to have to redo all (or some part) of these symlinks when reinstalling the OS or having something somewhere explode (say software uninstalled) so I have all the instructions in sync files in individual folders in the seafile drive

Which means I can easily back up my configuration and sync -r ~/Seafile to symlink it where it belongs

Description
No description provided
Readme 1.7 MiB
v1.3.0 Latest
2025-10-06 20:36:52 +00:00
Languages
Go 98.3%
Shell 1.7%