Nick Rout wrote: > On Monday 02 April 2007 23:06, Roger Searle wrote: > >> My backup script is working really well, even burns some files to a >> dvd. I'm impressed (and don't get out much). So of course I now need >> to test my backups (like we all do - right?). The problem I am having >> is how to then extract the contents of the tar files - all from a script. >> >> The backup files are all named via a declaration in the initial backup >> script, based on date like this: >> >> TarData=backup-data-`date +%a-%d-%m-%y`.tgz >> >> and I end up with a file called backup-data-Sun-01-04-07.tgz (similarly >> backup-email-Sun-01-04-07.tgz and backup-home-Sun-01-04-07.tgz etc). >> >> Simple enough to get them copied off the dvd into some folder - mount >> the disk, and then cp backup* /pathto/some/folder/. All good up to this >> point. I can also extract the contents of the tar files in a similar >> way using: >> >> tar -xvf $TarData >> >> and this too is all good, I get a restored copy of all my data. But >> this only works if it is the run on the same day as the tar file was >> made. How can I modify my "tar -xvf" line when I do not know the full >> names of my backup files - but do know the first few characters? I >> can't simply use wildcards i.e. tar -xvf back*. Google hasn't been >> friendly to me today. >> > > Surely the operator needs to know which date's backup to apply, or have some > way of determining that. ie the operator says "restore last sunday's data" by > inputting something like > > restore.sh data 070401 > > > and somewhere in the script it determines the filename like: > > backup-$1-$2.tgz > > except you'll have to translate between the user input of 070401 and the file > name of Sun-01-04-07 > This is something for me to digest a little later. Basically the application is copying all files that are on a particular dvd and unpacking them, so there is no need to worry about which date is being tested. > by the way I would leave off the day (Sun) and have the date written > backwards, like 2007-04-01 as it is then sortable quite easily, ie 2007-04-01 > will sort before 2007-04-02 but Sun-01-04-07 is going to sort after > Mon-02-04-07 > Yes good suggestion. Up to now this has just been a home backup solution where the "grandfather" backup files will be removed from hard drive once checked so doesn't matter too much. However I'm about to apply this to work where I do archive some backups permanently and my current scheme sorts just as you suggest. I'll make this a feature of v1.2 - thanks for the feedback. Roger
> > >> Cheers, >> Roger >> > >
