Monday, December 8, 2008

Fun with tar

Quick tip for copying directories between systems:

tar czf - -C /u01/app/oracle/stage/patchset cpu2008oct | ssh server2 tar xzf - -C /u01/app/oracle/stage/patchset

What's important here is the -C flag. In this case it tells tar to change working directory to /u01/app/oracle/stage/patchset, and only then begin backing up cpu2008oct. Same scenario on the extraction, change working directory then begin extracting.