home *** CD-ROM | disk | FTP | other *** search
- /*
- * daily backup treewalk routine - gets treewalk to check the exclusions
- * list, and then copies the files that need copying.
- *
- * Copyright (C) 1989 Mike Meyer
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 1, or any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
- mycom = getclip("daily.backup")
- '' mycom
- if rc ~= 0 then return 0
-
- in = arg(1) || arg(2)
- out = 'daily:'overlay("/", in, index(in, ':'))
- return copy(in, out)
-
- /*
- * copy - makes sure the directory is in place for the destination,
- * then copies infile to outfile.
- */
- copy: procedure
- parse arg infile, outfile
-
- /* Is the directory there? */
- outdex = lastpos('/', outfile)
- do while outdex > 0
- outdir = substr(outfile, 1, outdex - 1)
- if exists(outdir) then break
- outdex = lastpos('/', outfile, outdex - 1)
- end
- outdex = index(outfile, '/', outdex + 1)
-
- do while outdex > 0
- outdir = substr(outfile, 1, outdex - 1)
- address command 'makedir' outdir
- outdex = index(outfile, '/', outdex + 1)
- end
-
- address command 'copy' infile 'to' outfile
- return rc ~= 0
-
-