6 Replies Latest reply: Nov 14, 2012 2:33 PM by Andrew Saliga
Andrew Saliga Level 1 Level 1 (0 points)

I'm attempting to setup a script that will search a volume for all files of a specific extension then copy them to a folder that syncs with Dropbox. I'm very close, but am encountering an error.

 

Below is my script and the error.

rsync --progress -amch --stats --include="*/" --include="*.aep" --exclude="*" "/Volumes/MyName" "/Users/MyName/Dropbox/User Backups/MyName"

 

 

Error:

rsync: opendir "/Volumes/MyName/.DocumentRevisions-V100" failed: Permission denied (13)

Mac OS X (10.7.5)
  • Andrew Saliga Level 1 Level 1 (0 points)

    Is it because it's trying to copy a trashed file? I thought that adding

    --exclude=".*"
    

    would solve this, but no luck.

  • Andrew Saliga Level 1 Level 1 (0 points)

    Apparently the error is non-critical. I've refined the code. Feedback welcome.

     

     

    echo "Preparing to backup your  data to Dropbox"
    
    dropbox_account='/Users/Home/Dropbox/AdminFiles/User Backups/MyName/'
    current_date=`date +%Y%m%d`
    backup_path=${dropbox_account}''${current_date}' 
    
    rsync -avmct --stats --human-readable --itemize-changes --log-file="${backup_path}.log" --progress \
    --include="*/" --include="*.aep" --include="*.fcp" \
    --exclude="*" --exclude=".*" \
    "/Volumes/MyName" "${backup_path}"
    
  • Mark Jalbert Level 5 Level 5 (4,585 points)

    Your quoting will get you in trouble. The strong quotes in

     

    dropbox_account='/Users/Home/Dropbox/AdminFiles/User Backups/MyName/'
    

    works but weak quotes would be sufficent.

     

    dropbox_account="/Users/Home/Dropbox/AdminFiles/User Backups/MyName/"
    

     

    This has unmatched strong quotes that causes an error and ${current_date} or ${dropbox_account} wouldn't expand anyways.

     

    backup_path=${dropbox_account}''${current_date}'
    

    Your best effort would be to avoid file names with spaces if you are using the shell.

     

     backup_path="${dropbox_account}${current_date}"
    
  • Andrew Saliga Level 1 Level 1 (0 points)

    Thanks Mark! Changes made.

     

    Does the syntax and everything seem proper? I still get that permission issue, but the script runs. I'm not too familiar with scripting, but my mind is wired that way so I can generally figure our what I need with some trial and error.

  • Mark Jalbert Level 5 Level 5 (4,585 points)

    Yes, your script looks pretty good.  You might want to copy the extended attributes for the fcp and aep files. You could avoid the permissions problems by by-passing the OS X gobbledegoop at the root level of the volume. Narrow rsync's search path by specifying multiple directories on your volume. I'm assuming your shell is bash- you could use braced expansion.

     

    /Volumes/MyName/{SOURCE_ONE,SOURCE_TWO,SOURCE_THREE} "${backup_path}"
    
  • Andrew Saliga Level 1 Level 1 (0 points)

    Perfect. Thanks Mark.

     

    I reallly appreciate the help.