#!/bin/bash
# MPJ: My attempt to automate copying recent files to my public_html folder
echo "Copying files to the teaching system"

# Enter the number of hours ago 
hours=0;
# Enter the number of minutes ago
mins=5;

echo "Files changed within the last" $hours "hours and" $mins "minutes are:"
find * -mtime -$hours"h"$mins"m"
echo "---------------------------------"

# the files to copy.
location[0]='/Users/mpj1001/Angel/admin/admin_department/MPJ_website_2017/images/*'

# the location to copy the file to
# copyLocation='../temporary_copy_destination'
copyLocation='mpj1001@shell.srcf.net:~/public_html/images/.'

# perform the scp
for i in ${location[*]}
do
#        find $i \! -name '*.class' -mtime -$days \! -type d -exec cp {} $copyLocation \;
        echo "sampling file or folder called: " $i 
       find $i -maxdepth 0 -mtime -$hours"h"$mins"m" \! -exec scp -r {} $copyLocation \; 
done

