What do you mean by "more elegant solution"? I don't think it can be done as a one-liner. Someone else correct me if I am wrong.

Ross Drummond wrote:

I am attempting to fashion myself a backup script.

If I point tar at a directory it tars subdirectories which I don't want. I have come up with a solution which only tars files in the directory and ignores everything else. It works but it a bit of a kludge. Does anyone have a more elegant suggestion? Code below.

Script----------------------------------------------------------------------
#! /bin/bash

tar -czvf backup-`date +"%a-%d-%m-%y"`.tgz \
`find /var/www/html/ -type f -maxdepth 1` echo Done


End script-----------------------------------------------------------------

Cheers Ross Drummond






Reply via email to