1.

Solve : Tar Command Help?

Answer»

Hi there,

CURRENTLY trying to write a backup/restore script but I'm having difficulty getting the restore/extract FUNCTION to work as desired.

My directory structure is;
/root/scriptfiles/backups

with the scripts being held in:
/root/scriptfiles/


I'm currently using this command, which isn't working and need help with!

Code: [Select]tar -xvf /root/scriptfiles/backups/"$FILENAME" /root/scriptfiles/backups/"$filename" > /root/scriptfiles/logfiles/"Restore-$filename"
I'm unsure as to the syntax to USE, just a beginner.

What I'm trying to achieve with this script is to take the backed up files from the backup folder and extract them to the /root/ directory and rename of the extracted backed up directory to have "Restore-" at the start of the name.
i.e. Restore-Pictures-backup from Pictures-backup.tar

I hope this makes sence, been doing my head in for a while haha.

Thanks in advance for any guidance

EmDo the extract first and the rename second; don't try and do it all in one line.  "man tar" is your command line friend.



Discussion

No Comment Found