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
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make