[ale] Question about scripts
Brandon Checketts
brandon at brandonchecketts.com
Fri Jul 17 15:37:41 EDT 2009
Chuck Payne wrote:
> Guys,
>
> I need to copy a dir with a lot of files, and I want to make sure I
> get them all, but I can't get my script to write to my log, any clues
> how I can get to work? Also how I can get to dump to one line per
> file?
>
> #!/bin/sh
> touch /var/log/copyfiles.log
>
> dircopy="/vhosts/pictures/vikram"
> dirremote="/media1"
>
> while true ; do
> echo "`cp -R $dircopy/* $dirremote `" >> /var/log/copyfiles.log
> done
>
> Thanks
>
Is there a reason not to use rsync? It will copy everything, preserve file
permissions, owners, timestamps, etc. It can even copy between machines. A
simple directory-to-directory copy would be:
rsync -taz $dircopy $dirremote
The man page has tons of options available to do just about anything you can
imagine.
Thanks,
Brandon Checketts
More information about the Ale
mailing list