[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: script problem



Steve,

>Date: Thu, 13 Dec 2007 10:56:34 -0600
>From: "Steven Buehler" <steve ibushost com>  
>
>	I have a backup script that I wrote.  In it I have a variable that
>has listings of directories to back up.  Because of some of the sizes of the
>directories, and for other reasons, they now want me to break them where I
>back them up into multiple files with the name of the directory instead of
>all in one file.  It would be simple except that I can't find how to get
>just the final directory name for each directory.
<snip>

Try this: DON'T hard-code the directories. Create a configuration file, and put them in there. That way, anyone can always expand or shorten the list, without ever touching the code. You could actually do this in perl, btw. For example,
#!/usr/bin/perl

use strict;

my $bu_dir;

open ( CONF, $ARGV[0] );

while ( $bu_dir = <CONF> ) {
   system( "echo \"tar $bu_dir.tar $bu_dir/\"");
}

      mark



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]