I'm trying to put together a shell script (one liner) that will backup the contents of a specified directory into a gzipped tarball. I'm trying to filter out what I want backed up with find's iregexp option but I'm stuck. Does the -iregexp treat parenthesis as metacharacters because I'm not getting the results I want?
Here is the script I'm using. Problem is with the (), they don't seem to be treated as the proper regular expression because nothing is returned.
find media/ -iregex '.*\.(jpg|jpeg)'
Anybody have any ideas on how I can do this?
The final script should look something like this
find media/ -iregex '.*\.(jpg|jpeg)' | xargs tar -cvzf backup.tar.gz
PS. If you're wondering what I'll be using this for, its for a php script. I don't run a linux box at home.