GITFOLDER="/srv/some/folder" ls-files --others --exclude-standard | tar czf ${GITFOLDER}-archives/uploads-$(date '+%Y%m%d%H%M').tar.gz -T -
Assuming your web app has a git checkout is in /srv/some/folder
(i.e. there is a /srv/some/folder/.git
), archive the user uploads to /srv/some/folder-archives
with that one liner.
Use:
cd /srv/some/folder
# this one-liner
A fully complete script would:
$GITFOLDER
exists$GITFOLDER
has a .git
directorytmp=$(mktemp)
) file to log anything; if [ "$?" -ne 0 ] ;
exit with status exit 1
, otherwise delete the $tmp
file and exit 0
.