Script to monitor time taken to copy a File error
Dear All,
I am trying to write a script to monitor time taken to copy a File from a SAN volume to a disk on a workstation and I get the error below:
cp: cannot stat `/Volumes/RAID 1/copydownfolder/copyupfolder:': No such file or directory
I would like the script to skip any folders in the source directory. Please see the script below...
#!/bin/sh
dir1="/Users/admin/Desktop/copydownfolder/"
format="%-30s %-30s %-10s\n"
format1="%-1s %-1s\n"
printf "$format1" SECTION I
printf "$format" "Date and Time", "File Copy Duration", "Filename"
printf "$format" "-------------", "------------------", "-----------------------------------------------------"
## Section I
IFS=$'\n'
for L in $(ls /Volumes/RAID\ */copydownfolder/*)
do
if [ ! -d $L ]; then
exit 1
fi
before=$(date +%s)
# commands to time go here
`cp $L $dir1`
after=$(date +%s)
elapsed_seconds=$(expr $after - $before)
printf "$format" $(date), $elapsed_seconds, $L
done
format2="%-1s\n"
printf "$format2"
Thank you for your response..
|