AFJ
AFJ

Reputation: 159

AppleScript and rsync - trouble excluding list of directories

i'm having trouble telling rsync to exclude a list of directories from the sync process. I'm feeding it a text file using the exclude-from command, but it seems to be ignoring it.

here's the code I'm trying to use in applescript:

set log_file to "/Users/x/Sync Test Folder/log.txt"
set exclude_file to "/Users/x/Sync Test Folder/log2.txt"
set target_folder to "/Users/x/Sync Test Folder"
set source_folder to "/Users/x/source_test/sub/" 

tell application "Terminal"
    activate
    set currentTab to do script "rsync" & " -avPhr " & "--include '*/' --exclude='*' --exclude-from=" & quoted form of exclude_file & " --log-file= " & quoted form of log_file & " " & quoted form of source_folder & " " & quoted form of target_folder & " >>" & quoted form of log_file
end tell

Right now i'm manually typing in the log2.txt file the name of the directory i want to exclude as /directory_2/ but this doesn't seem to work.

can someone help point out what might be wrong?

thanks

Upvotes: 0

Views: 84

Answers (1)

AFJ
AFJ

Reputation: 159

I figured out the answer the problem. It turns out the order in which you use the include or exclude/exclude-from statements is important. So by just moving the exclude statements to the beginning of the command and the include statement to the end, everything works as expected.

Upvotes: 0

Related Questions