niels Posted February 15, 2011 Share Posted February 15, 2011 Hey everybody, I'm writing a script to automaticaly backup a directory with the tar command. Now I tried several different approaches to use relative paths but I can't get it working. I always get the following error : tar: Removing leading `/' from member names I tried the tar -cjfP $TAR_FILE $DATA, or tar -cjfP $TAR_FILE -C /$DATA and my last approach is creating a textfile with each file name to add to the tar file, like this : # --- BEGIN --- DATA="/CVS_Repository/ErikStevensBackUp" DATA_LIST="/Backups/backup_list.txt" TAR_FILE="/Backups/ErikStevensBackup-`date +"%d-%m-%Y"`.tar.bz2" # first remove old backup rm -f /Backups/ErikStevensBackup*.*.* # Create dataList find $DATA -depth -print > $DATA_LIST # create backup with date tar -cjfTP $TARFILE $DATA_LIST # Remove old data list file rm -f $DATA_LIST # --- END --- Anybody has a answers for my problem ? I'm using Ubuntu 10.04 Server edtion. Thanks a lot in advance. Regards, Niels Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.