In reply to:
Hello. I'm trying to set up a cronjob to copy selected files from one particular directory in a website to another directory in that same website.
Tip: If the command is complex, or you haven't thoroughly tested it yet to satisfaction, don't use it for the cronjob. Use a shell script instead, and put the command in the shell script. Then you don't have to modify the crontab in order to debug the command.
In reply to:
rsync --filter '- *_thumb.jpg' --filter '- *_medium.jpg' -e ssh -av /home/.newie/username/domain/images/gallery/ /home/.newie/username/domain/slideshow/
This isn't a remote operation, so drop the -e argument.
A shell script might look like this:
#!/bin/bash
SOURCE=$HOME/domain/images/gallery/
DEST=$HOME/domain/slideshow/
FILTER="--exclude=*_thump.jpg --exclude=*_medium.jpg"
OPT=-av
# Command line argument handling
while [ $# -gt 0 ]; do
case "$1" in
-q|--quiet)
# Redirect stdout and stderr so there is no output
exec &>/dev/null
;;
-d|--dry-run)
# Do not make changes.
OPT=-nav
;;
esac
shift # Check next set of parameters.
done
rsync $OPT $FILTER $SOURCE $DEST
Then for you crontab you can do either
1. - if you did chmod 755 on script.sh -
/home/username/path/script.sh
2. - if you did chmod the script file -
/bin/bash /home/username/path/script.sh
And you got options: -q or --quiet and -d or --dry-run
Customer since 2000
openvein.org