I have a simple shell script. What i'd like to do, is copy the files in /home/imp/imp/msgs/
to /home/imp/imp/msgs/bak/
, but only if they are newer in the source directory than the destination directory.
#!/bin/bash
cp /home/imp/imp/msgs/*.MIX /home/imp/imp/msgs/bak/
cp /home/imp/imp/msgs/*.BRD /home/imp/imp/msgs/bak/
I tried cp -u
, but it doesn't seem to work for me.
Best Answer
You can use rsync with the pattern
*.MIX
and*.BRD
, e.g