lcd manual
About
The 'lcd' command allows you to move forward and backwards though time in a similar way to using the built-in cd directory to change your current working directory. Essentially, the 'lcd' command moved your directory into a more recent or less recent backup snapshot but keeps your relative position within the snapshot if possible.
When to Use
If you are searching for a file then you may move forwards or backwards though time using the 'lcd' to find the file you wish to locate within your backup set(s). This tool also provide the basis of more advanced tools which could potentially scan forward or backwards for changes to a particular file or directory.
Usage Examples
Once you are within a LBackup backup snapshot then you can issue the commands below to move forward and backwards though time within this backup set.
Usage examples : Move to a more recent backup: . /usr/local/sbin/lcd future Move to an older backup: . /usr/local/sbin/lcd past
If you are using the bash shell then you can use the alias function as specified in the help :
alias lcd="source /usr/local/sbin/lcd"
Then you can simply use the command as listed below :
Usage examples (with alias) : Move to a more recent backup: lcd future Move to an older backup: lcd past
If you are having problems with this command then please ask for help on the LBackup mailing list.
Scripting with LCD
It is possible to create scripts which call the 'lcd' command and search though within your backup set(s) for specific files, changes in files or for directly listing changes (eg. renaming of a file, deletion of a file, etc.)
In order to use the 'lcd' command from within a script you must be running LBackup 0.9.8r4-alpha9 or later. In addition, you will need to pass the '-s' flag to the lcd command when invoked within a script. Below there is a basic example script listed along with the scripts output :
Sample Script
Sample Script Listing
#!/bin/bash cd /tmp/dst/Section.3/src pwd ls -l echo "moving to a more recent backup" . /usr/local/sbin/lcd -s future pwd echo "moving to a more recent backup" . /usr/local/sbin/lcd -s future pwd echo "moving back to an older backup" source /usr/local/sbin/lcd -s past pwd ls exit 0
Sample Script Output
Output from running the test script, assuming you have a backup set located at the following path : '/tmp/dst/'
/tmp/lcd_test.bash /private/tmp/dst/Section.3/src total 8 drwxr-xr-x@ 4 lbackup wheel 136 Jun 18 10:28 Adium.app -rw-rw-r--@ 7 lbackup wheel 2620 Jan 6 14:37 README.TXT moving to a more recent backup /private/tmp/dst/Section.2/src moving to a more recent backup /private/tmp/dst/Section.1/src moving three to an older backup /private/tmp/dst/Section.2/src Adium.app README.TXT
Helpful Links
- lcd configuration (basic lcd configuration information)