Command to back up files on a server?

Soldato
Joined
4 Jul 2004
Posts
2,647
Location
aberdeen
Hi,
What would be the best command to run (Via a cronjob or maybe a php script) to backup all files apart from image files (jpg,jpeg,png,gif) and under 1mb, and zip (or tar.gz) them? I've searched on google but can't come up with anything

thanks
 
Man of Honour
Joined
11 Mar 2003
Posts
10,706
Location
Greenock, Scotland
On Lunix/UNIX or Windows?

The UNIX find command is pretty much what you want, the command line options are complex but as a result very configurable, use the -name and -size options to filter what you want and the -exec option to tar them up.
 
Man of Honour
Joined
11 Mar 2003
Posts
10,706
Location
Greenock, Scotland
This seems as good as any

To get the hang of the options take it slowly and build up the command you need. Start with a find . /name '*.jpg' -print for example and make sure that it returns the correct list of JPGs, then expand it to take into account the time element and finally either pipe the output to gzip or use the -exec switch to do it all in the find.
 
Back
Top Bottom