Coder Social home page Coder Social logo

directory-sync's Introduction

MacOS Directory Sync

Tool designed for keeping a remote directory in sync with a git repository in a local directory. This is useful for developing code locally and syncing with a web server, similar to WinSCP. Note that the contents of the entire source directory is synced into the destination directory but directories can be excluded by modifying the EXCLUDES array. For example, given the following source directory:

source/file1.php
source/file2.php
source/lib/library.php

The command directory-sync.sh -i -s `pwd` -d /var/www/html will result in the following files in the destination directory:

/var/www/html/file1.php
/var/www/html/file2.php
/var/www/html/lib/library.php

Based on boneskull/hook-line-and-syncer.

Requires

brew install fswatch

Usage

directory-sync -s *source-dir* -d *destination** [-i] [-l *log-file*] [-e *excludes-file*] [-r *remote-shell*]
Where:
    -d The destination (local directory or remote location).
    -s The source directory. The contents of the directory will be synced, not the directory itself.
    -r Optional remote shell to use for rsync. Useful for specifying an alternate ssh port.
    -i Perform an initial sync before enabling the file watcher on the source directory.
    -l rsync log file

Examples

Perform an initial sync of the current directory and any subsequent changes to another local directory:

directory-sync.sh -i -s source/ -d /var/www/html

Sync only changes to the "source" directory to a remote host

directory-sync.sh -s source/ -d remotehost.com:/var/www/html

Perform an initial sync of the current directory and any subsequent changes to a remote server:

directory-sync.sh -s `pwd` -d remotehost.com:/var/www/html -i

Perform an initial sync of the current directory and any subsequent changes to a remote server using ssh on port 1027:

directory-sync.sh -s `pwd` -d remotehost.com:/var/www/html -r 'ssh -p 1027' -i

directory-sync's People

Watchers

Steve Gallo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.