Linux でフォルダ丸ごとバックアップするコマンド
フォルダを丸ごとバックアップするlinuxコマンドです。
- バックアップ元
- /var/www/html/hogehoge.com
- バックアップ先
- /temp/hogehoge.com.tar.bz2
tar -cvjf /temp/hogehoge.com.tar.bz2 /var/www/html/hogehoge.com
img フォルダだけは除外したいような場合は --exclude :img をつけます。
tar -cvjf /temp/hogehoge.com.tar.bz2 /var/www/html/hogehoge.com --exclude img
img、cache といった複数のフォルダーを除外したい場合は
tar -cvjf /temp/hogehoge.com.tar.bz2 /var/www/html/hogehoge.com --exclude img --exclude img