Coder Social home page Coder Social logo

codiceovvio / diff-orphans Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jelchison/diff-orphans

0.0 2.0 0.0 16 KB

Bash script to efficiently identify orphaned files in large trees. Useful for sanity-checking after copying large trees. This script should be capable of running in OS X or in Linux.

License: GNU General Public License v2.0

Shell 100.00%

diff-orphans's Introduction

diff-orphans

This is a Bash script that efficiently identifies orphan files in large trees. (An orphan file is a file that exists in one tree but not another.) The script is useful for sanity-checking after copying large trees, without diff'ing the file contents of the entire tree. This script should be capable of running in OS X or in Linux.

This method operates by creating sorted file listings for each of the trees, and then using the standard diff tool on the file listings. While this method does not detect differences in file contents, it does identify any missing files in either tree.

Environment

  • Any OS having a Bash environment
  • The following tools must be installed, executable, and in the PATH:
    • readlink
    • basename
    • find
    • sort
    • sed
    • diff
    • rm

Installation

Simply copy diff-orphans.sh to a directory of your choosing. Don't forget to make it executable:

chmod +x diff-orphans.sh

Usage

./diff-orphans.sh <leftTree> <rightTree>

Example usage

The following example shows that the "right" directory has an (extra) orphan file named "file5":

user@computer:~$ ./diff-orphans.sh left/ right/
[+] Testing dependencies...
[+] Validating arguments...
[+] Performing diff of trees...
2d1
< file5
[*] Success

The following example shows identical "left" and "right" directories (no orphans):

user@computer:~$ ./diff-orphans.sh left/ right/
[+] Testing dependencies...
[+] Validating arguments...
[+] Performing diff of trees...
[*] No orphans found
[*] Success

diff-orphans's People

Contributors

jelchison avatar

Watchers

 avatar  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.