help-make
[Top][All Lists]
Advanced

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

Re: using make for backups


From: Harvey Chapman
Subject: Re: using make for backups
Date: Mon, 24 Aug 2009 10:06:40 -0400

Perhaps something like this might work. It just uses find to find the first item in the tree newer than the archive. It uses the output to force a rebuild. The downside is that the find may take a while. If anyone has more feedback, I'd appreciate it as I need something like this as well.

#-*-Makefile-*-

DIR_NAME=files
TGZ_NAME=$(DIR_NAME).tgz

.PHONY: clean all
all: $(TGZ_NAME)
        @echo "Build complete."


NEW_FILES=$(shell find $(DIR_NAME) -newer $(TGZ_NAME) -print -quit 2> / dev/null)

$(TGZ_NAME): $(NEW_FILES)
        @echo "tar -cvzf $@ $(DIR_NAME)"
        @tar -cvzf $@ $(DIR_NAME)

clean:
        @rm -f $(TGZ_NAME)

On Aug 24, 2009, at 7:15 AM, Payal wrote:

Hi all
Daily I take backup of a folder like this.
tar -czf d-`date +%d%m%y`.tar.gz designs/
The size comes ~ 2Gb of tar ball.
There are tens of folders/sub-folders inside design/.
I observed that many days none of the files in design folder are changed or are added/deleted and
I am wasting resources making the tar-ball daily.

Can I use make to take backups if files inside design/ are modified/ added/deleted or do I rather
depend on tar to figure it out?

With warm regards,
-Payal


_______________________________________________
Help-make mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-make





reply via email to

[Prev in Thread] Current Thread [Next in Thread]