Ubuntu 12 - Converting Absolute Symlinks

One of my earlier tutorials talked about using Rsync as a backup solution for large sets of files where incremental backups is not an option. One of the options in the command I specified was to copy-unsafe-links which will copy the source file rather than the symlink when the symlink is evaluated to be unsafe. The idea is to copy any files that are outside of the directory structure that you are copying so that you still have a copy of the file. Unfortunately, all absolute symlinks are considered "unsafe". Thus, to prevent rsync wasting space by creating unnecessary duplicates, one needs to convert absolute symlinks to be relative which this tutorial will now show you how to do:

    First, you need to install the symlinks tool.
    sudo apt-get install symlinks
    Navigate to the directory you want to convert symlinks within, and run the following command:
    symlinks -crv .
    c = Change
    r = recursive
    v = Verbose
    This will not work as effectively when call the symlink command from path that itself is symlinked. E.g. you will see a LOT more of "../" in your symlinks than you need. To resolve this, run the following command first:
    pwd -LP > cd


No comments:

Post a Comment