Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Tucker28

macrumors member
Original poster
Mar 4, 2012
41
18
Hello,
I am trying to send certain files to specific folders based on filenames. Most things I want to do like this, I can do with Hazel, but not this just because of the sheer number of rules I would have to make. Hazel doesn't allow me to put wildcards on the move to section of the rule.

When I'm ripping my TV series DVD's and Blu-rays, I've been letting the TV app handle moving everything to where I need it. This works great except for the special episodes [anything with a season 0 (S00) in the filename]. The TV app puts those directly under the series name folder and not under a Season 0 folder. Either way, it doesn't list the episodes as special episodes but more to the point, I only use it as the last step in the automation to move them. Plex is what I use for the server, and Plex requires specials to be in a Season 0 folder. If they're not, it just puts them under Season 1. This is the reason I'm trying to get the same thing done with AppleScript/Automator.

I'll use the DVD set I'm currently ripping as an example. If, for instance, the filename is Mama's Family S00E01, I need it to move the file to the TV series library folder /Media/Series/Mama's Family/Season 0/

But I'm not that familiar with AppleScript... I can make *some* simple scripts with Automator for folder actions, but this is more complicated, plus it doesn't allow any wildcards in the move dialog box. It's just not feasible to make a separate rule for every series and every season. I do know AppleScript doesn't use RegEx even if it let me. So, I'm uncertain how to proceed.
 
I cobbled together an AppleScript that should accomplish most of your goals, let me know if you are still looking for a solution and I'll post it.
 
Please do!

I‘m looking to figure out AppleScript as well as solve this problem, and seeing practical examples helps me learn much better. Thanks!
 
Ok, here you go....

This is currently written to run form Script Editor.app as a proof of concept but can be adopted to run as a droplet or service as needed. Not sure where this fits into your current workflow so let me know and we can make the necessary changes.

When run from within Script Editor.app it will ask you to choose a file and then:
- Check if the filename contains 'S00'
- If true, extract the Series Name from the filename, if false script exits.
- If a Series name is extracted it will check if the proper folders exist and create them if needed (i.e. /SeriesName folder & /SeriesName/Season 0/ folder).
- move the selected file into the SeriesName/Season 0/ folder.

You'll need to change the 'theMediaVolumePath' (third line in file) variable to the path to your Series folder. It will need to be in the form of 'MountedVolume:FolderName:Foldername:'. I'd suggest setting up a test directory first before pointing at your live Series folder.

There are a bunch of ways to accomplish your goals, this is just one. It uses only AppleScript but could also use a combo of AppleScript and shell command calls. Let me know how it goes and where in your workflow this needs to be incorporated and we can make the necessary modifications.

AppleScript:
--set variable for referencing 'Season 0' folder
set theSeason to "Season 0"

--set variable for referencing the season in a filename
set theSeasonKey to "S00"

--set path to your media volume
set theMediaVolumePath to "Volume:Folder:Folder:Folder:"

--set variable for the file to process
set theFile to choose file

--create empty list variable for create_FolderStructure handler
set theFolderStructure to {}

--create variable with the file's name
tell application "Finder" to set theFilename to get name of theFile

try
    --check if the chosen file has 'S00' in the filename. Script exits if false.
    if theFilename contains theSeasonKey then --if true
        
        --pass variables to handler to extract the series name from the file name and assign to variable
        set theSeriesName to extract_SeriesName(theFilename, theSeasonKey)
        
        --pass variables to handler to create list of folder paths and assign to variable
        set theFolderStructure to my create_FolderStructure(theMediaVolumePath, theSeriesName, theSeason)
        
        -- pass variables to the handler to check for proper folder structure and move the file
        my move_theFile(theFile, theMediaVolumePath, theFolderStructure, theSeason, theSeriesName)
        --display notification on successful move
        display notification theFilename & " was successfully moved to " & (item 2 of theFolderStructure) with title "Special Episode Processor" sound name "Frog"
    end if
on error
    --display notification on error
    display notification "There was an erorr moving " & theFilename & "." with title "Special Episode Processor" sound name "Frog"
end try


--Script Handlers--

--Handler to extract just the name of the series from the filename. Assumes file naming is always SeriesName S**E**.***
on extract_SeriesName(theFile, theSeasonKey)
    --find the numerical position of 'S00' in the filename
    set theSeries to offset of theSeasonKey in theFile
    --set variable for the numerical end of the series name
    set theEnd to theSeries - 2
    --set variable to characters of filename startting at begining of name through the offset of 'S00'
    set theSeriesName to characters 1 thru theEnd of theFile as string
    --return the series name extracted from filename
    return theSeriesName
end extract_SeriesName

-- Handler to check for the appropriate folder structure, create folders as needed and move the selected file
on move_theFile(theFile, theMediaVolumePath, theFolderStructure, theSeason, theSeriesName)
    tell application "Finder"
        --check if a folder with the series name is present
        if exists folder (item 1 of theFolderStructure) then --if true
            --check if a 'Season 0' folder exists in the series folder
            if exists folder (item 2 of theFolderStructure) then --if true
                --move the selected file
                move file (theFile as alias) to (item 2 of theFolderStructure)
            else
                --if no season 0 folder exists create one
                make new folder at (item 1 of theFolderStructure as alias) with properties {name:theSeason}
                --move the selected file
                move file (theFile as alias) to (item 2 of theFolderStructure)
            end if
        else
            --if no series folder exists create series folder
            make new folder at (theMediaVolumePath as alias) with properties {name:theSeriesName}
            --create 'Season 0' folder in series folder
            make new folder at (item 1 of theFolderStructure as alias) with properties {name:theSeason}
            --move selected file
            move file (theFile as alias) to (item 2 of theFolderStructure)
        end if
    end tell
end move_theFile

--Handler to create a list of folder paths to pass to the move_theFile handler
on create_FolderStructure(theMediaVolumePath, theSeriesName, theSeason)
    --create a variable with the path to the series folder based on the passed variables
    set theSeriesNameFolder to (theMediaVolumePath & theSeriesName)
    --create a variable with the path to the 'Season 0' folder based on the passed variables
    set theSeasonFolder to (theSeriesNameFolder & ":" & theSeason)
    --return the list of folder paths to use in move_theFile handler
    return {theSeriesNameFolder, theSeasonFolder}
    
end create_FolderStructure
 
Wow, that’s awesome. I can follow code usually, but your comments make it so easy to know what’s going on.

Ideally, I would use it inside a folder action (if possible), so that way it’s all handled automatically. I have several automations from Hazel running all starting with folders linked with Resilio Sync. That way I can rip on my MacBook and Resilio Sync syncs to the server where all the other Hazel rules are.

My roadblock I’ve been having is Hazel runs every minute or so and sometimes the files aren’t finished. I thought about using the modified time stamp not being changed in the past # minutes. And that does work. Yet sometimes when I start up again after after several days and I still have files to sync then the modified time stamp is too old and Hazel tries to start processing before the files are completely transferred.

Is there anything I could include in an AppleScript that would not run until a file was complete so that I could use this as a folder action? Is that even possible? Using it as a service, app, or droplet, there’s no need as it would only be ran when I manually activated it. But with a folder action, would it have the same problem as Hazel and try to run before the files were finished? Some of these rips are pretty big, and while I have good WiFi throughput, my MacBook is 10 years old and is limited to Wireless N, so while it doesn’t take long to transfer them, I do have automations running before the file is completely there.

Modified date works as long as I keep working, but I do have issues when I come back to it after a break. Is there a good way with AppleScript to add in a condition that if the file size hasn’t changed in 5 minutes, then it could continue?

And, seriously, thanks again for typing in all the comments! Makes it really easy to follow the code, and much easier for me to learn how the commands work. 😃
 
No problem....a lot to unpack in your response. Can definitely do something with AppleScript to wait until the file is created but there are a couple ways to tackle this, just need more info.

- Is your current process to rip to a server folder and then Hazel moves those files elsewhere? --Nevermind re-read your post and figured that out
- What software are you using to rip and is that process automated?
 
Last edited:
No, the ripping isn’t automated. I have no idea how I’d go about automating that part. For my DVD’s, I load the disc and use Handbrake. I have presets, but I always double check them, then name each each file with the Series, season, and episode. Any Blu-Ray discs go through MakeMKV. Then when it’s ripped, I move them to the Resilio Sync monitored folder, and that takes care of syncing to the server and is where the automation needs to work.

From that point, I have been trying to set up the automation with Hazel on the server. Using the “not modified in the last # minutes” works perfectly if the file being created over there uses time stamps from the moment it’s copied. But Resilio Sync preserves the time stamps. So (especially when I come back from a break of a few hours or few days or few weeks) it doesn’t work and Hazel jumps on the rules within a minute once the file shows up, even if it’s not complete, which just generates chaos.

if it’s a movie I’m ripping, it just sends it straight to the Plex Movie library. If it’s a TV series, it gets dumped into a folder that iFlicks monitors. iFlicks loads the episodes up, inserts all metadata, and then saves it in another iFlicks completed folder. This is the folder than then sends it to the Plex Series Library and needs to be sorted into seasons. The TV App wants to put specials in the series root folder, which Plex doesn’t monitor which is what breaks it.

Using Hazel, I’ve gotten close to what I need to do, it’s just that it triggers before the file has been completely synced with large files, since syncing software and copy preserves time stamps. Small files it works perfectly. But video files are hundred of megabytes if not gigabytes in size and the rules begin before it’s all there. I can’t find an option that says “do this if the file size hasn’t changed in the last 5 minutes”, that way as long as the file was still be written and still getting larger, nothing would happen until it was complete.

That and the season sorting are my last two hurdles.

By the way, thanks so much for this. I thought I had everything but the series/season sorting done when I originally posted. But upon watching these files, a lot were either incomplete or were corrupted and so I looked at the logs and in real time and realized it was running before the files were complete. Very sorry to have added an item. I really need a course in AppleScript and Shell Scripts.
 
No worries..the explanation above helps clarify a few things. I have a couple ideas that I’ll test out tomorrow morning and let you know.
 
Do you know if Resilio Sync writes to a log file upon a successful file transfer?
 
It does. Took me a bit to find it. You can see the history inside the app itself. But it keeps a more in-depth log in /Users/username/Library/ApplicationSupport/ResilioSync/sync.log where it writes everything. But it did include the following:

Finished downloading file “/Volumes/filepath/filename”
 
Last edited:
Ok, that is good news. If you can sync the log file to your server I'd suggest something like this:

  1. Setup the log file to sync to the server
  2. Add an AppleScript to the top of your Hazel task on the server that does the following:
    1. Creates a list of all files in the watched folder​
    2. Searches the Resilio Sync log file for each filename in the created list​
    3. If the search result contains 'Finished Downloading' for a filename, AppleScript will assign a 'green' Finder label to the file​
    4. Add a filter to your Hazel task that only processes 'green' labeled files in the watched folder (Note: we could also do the reverse and mark a file that hasn't finished syncing with a 'red' label and you could filter those out in Hazel)​
So based on those changes what should hypothetically happen is:

  1. Resilio Sync starts its sync
  2. Hazel runs and the AppleScript searches the log file and labels the files in the watched folder that have finished downloading.
  3. Hazel then only processes files that are green (ignoring files that are still syncing).
  4. Resilio Sync finishes its sync and updates its log file which should trigger a sync of the log file to the server.
  5. Hazel runs and updates the files accordingly to the new log file entries.
  6. Rinse & Repeat.

By relying on the log file you don't have to worry about interrupted syncs. Hazel will ignore those until they have been successfully downloaded.

Let me know if this would work and I can post an AppleScript that will test searching the log file for filenames.
 
Funny you should mention labels, I tried to do something similar a few days ago, but I didn’t think of using the log files. I had a rule at the top that gave every new file a red label and was using that in the rest of the rules to only trigger when the label was red. Unfortunately, that was labeling the files red before they were finished downloading as well. The upshot of this is the rest of the Hazel rules already have the label conditions in them before they run.

No need to sync the log file to the server as I was looking at the servers logs remotely since I figured they were the ones you wanted. Each machine with Resilio Sync installed keeps its own logs. Oddly enough, the sending client keeps no record of when it finished uploading the file in the logs, though the receiving client does.

A few caveats:
  • The actual syncing history seems to be kept in its own .dat, .db, and .db-wal extensions which are not human readable.
  • They don’t show up in the log unless the ‘debug log’ option is checked which I didn’t realize until I rechecked this morning. At which point, I get dozens of log entries per second. Can we use something like that when it’s growing so fast?
  • Also, there seems to be 2 messages regarding finishing downloading each file. The first one is the file itself, and several dozen lines later, there’s another entry about finishing downloading the file and all its metadata.
I will post the pertinent section of the log file from the receiving client just from the test run I made today to show you what I mean. I highlighted both of the finished downloading messages in red so you can find them easier. As you can see, there are hundreds of messages and they cover ~16 seconds.

[20201218 14:04:27.390] SF[6E52:0AEF]: recognized incoming PeerMessageConnection

[20201218 14:04:27.390] PeerMsgConn[03161A20]: created incoming merge

[20201218 14:04:27.390] SF[6E52:0AEF] [FB7B]: Received request "state_notify"

[20201218 14:04:27.390] SF[6E52:0AEF] [FB7B]: Got state notify - tree:E24937F3BD2655F968D89F166FA7B641FD60B888 pieces:EFB5C56C9141DED3B740D47AA954FC39C3274786

[20201218 14:04:27.390] PeerMsgConn[03161A20]: state changed incoming merge 3

[20201218 14:04:27.390] PeerMsgConn[03161A20]: destroyed incoming merge cnt=1

[20201218 14:04:27.503] 16TunnelConnection[0x00007fa637a75ce0]: got packet 4 for unknown connection id=963638096

[20201218 14:04:29.009] SF[6E52:0AEF]: UpdatePeersStat

[20201218 14:04:29.010] SF[6E52:0AEF] [A4FB]: up:0 down:0

[20201218 14:04:29.010] SF[6E52:0AEF] [FB7B]: up:0 down:0

[20201218 14:04:29.010] SF[6E52:0AEF]: up_diff:0 down_diff:0 up_speed:0 down_speed:0

[20201218 14:04:29.010] ScheduledTask: "UpdatePeersStat" invoked: timer, reason:FinishStateSync

[20201218 14:04:29.483] SF[6E52:0AEF]: recognized incoming PeerMessageConnection

[20201218 14:04:29.483] PeerMsgConn[031FF5C0]: created incoming merge

[20201218 14:04:29.483] SF[6E52:0AEF] [A4FB]: Received request "id"

[20201218 14:04:29.483] SF[6E52:0AEF] [A4FB]: Got id message from peer MacBook Pro (20F00E584888CCB22A219BF6E6216E920556A4FB) 2.7.2

[20201218 14:04:29.483] SF[6E52:0AEF] [A4FB]: Got state sync request

[20201218 14:04:29.483] PeerMsgConn[031FF5C0]: state changed incoming merge 1

[20201218 14:04:29.483] SF[6E52:0AEF] [A4FB]: Received request "get_root"

[20201218 14:04:29.483] SF[6E52:0AEF] [A4FB]: ConecurrentMergeController has started merge request[0x00006000031ff5c0] processing

[20201218 14:04:29.483] MC[6E52:0AEF] [A4FB]: processing get_root message, my hash: E24937F3BD2655F968D89F166FA7B641FD60B888, remote hash E24937F3BD2655F968D89F166FA7B641FD60B888, full_merge: 0

[20201218 14:04:29.540] PeerMsgConn[031FF5C0]: state changed incoming merge 3

[20201218 14:04:29.540] SF[6E52:0AEF] [A4FB]: State sync finished

[20201218 14:04:29.540] PeerMsgConn[031FF5C0]: destroyed incoming merge cnt=2

[20201218 14:04:30.416] SF[6E52:0AEF]: recognized incoming PeerMessageConnection

[20201218 14:04:30.416] PeerMsgConn[031F6720]: created incoming merge

[20201218 14:04:30.416] SF[6E52:0AEF] [A4FB]: Received request "id"

[20201218 14:04:30.416] SF[6E52:0AEF] [A4FB]: Got id message from peer MacBook Pro (20F00E584888CCB22A219BF6E6216E920556A4FB) 2.7.2

[20201218 14:04:30.416] SF[6E52:0AEF] [A4FB]: Got state sync request

[20201218 14:04:30.416] PeerMsgConn[031F6720]: state changed incoming merge 1

[20201218 14:04:30.416] SF[6E52:0AEF] [A4FB]: Received request "get_root"

[20201218 14:04:30.416] SF[6E52:0AEF] [A4FB]: ConecurrentMergeController has started merge request[0x00006000031f6720] processing

[20201218 14:04:30.416] MC[6E52:0AEF] [A4FB]: processing get_root message, my hash: E24937F3BD2655F968D89F166FA7B641FD60B888, remote hash E24937F3BD2655F968D89F166FA7B641FD60B888, full_merge: 0

[20201218 14:04:30.472] PeerMsgConn[031F6720]: state changed incoming merge 3

[20201218 14:04:30.472] SF[6E52:0AEF] [A4FB]: State sync finished

[20201218 14:04:30.472] PeerMsgConn[031F6720]: destroyed incoming merge cnt=2

[20201218 14:04:31.311] SF[6E52:0AEF]: recognized incoming PeerMessageConnection

[20201218 14:04:31.311] PeerMsgConn[031F6720]: created incoming merge

[20201218 14:04:31.312] SF[6E52:0AEF] [A4FB]: Received request "id"

[20201218 14:04:31.312] SF[6E52:0AEF] [A4FB]: Got id message from peer MacBook Pro (20F00E584888CCB22A219BF6E6216E920556A4FB) 2.7.2

[20201218 14:04:31.312] SF[6E52:0AEF] [A4FB]: Got state sync request

[20201218 14:04:31.312] PeerMsgConn[031F6720]: state changed incoming merge 1

[20201218 14:04:31.312] SF[6E52:0AEF] [A4FB]: Received request "get_root"

[20201218 14:04:31.312] SF[6E52:0AEF] [A4FB]: ConecurrentMergeController has started merge request[0x00006000031f6720] processing

[20201218 14:04:31.312] MC[6E52:0AEF] [A4FB]: processing get_root message, my hash: E24937F3BD2655F968D89F166FA7B641FD60B888, remote hash E24937F3BD2655F968D89F166FA7B641FD60B888, full_merge: 0

[20201218 14:04:31.366] PeerMsgConn[031F6720]: state changed incoming merge 3

[20201218 14:04:31.366] SF[6E52:0AEF] [A4FB]: State sync finished

[20201218 14:04:31.366] PeerMsgConn[031F6720]: destroyed incoming merge cnt=2

[20201218 14:04:32.204] SF[6E52:0AEF]: recognized incoming PeerMessageConnection

[20201218 14:04:32.204] PeerMsgConn[031F6720]: created incoming merge

[20201218 14:04:32.204] SF[6E52:0AEF] [A4FB]: Received request "id"

[20201218 14:04:32.204] SF[6E52:0AEF] [A4FB]: Got id message from peer MacBook Pro (20F00E584888CCB22A219BF6E6216E920556A4FB) 2.7.2

[20201218 14:04:32.205] SF[6E52:0AEF] [A4FB]: Got state sync request

[20201218 14:04:32.205] PeerMsgConn[031F6720]: state changed incoming merge 1

[20201218 14:04:32.205] SF[6E52:0AEF] [A4FB]: Received request "get_root"

[20201218 14:04:32.205] SF[6E52:0AEF] [A4FB]: ConecurrentMergeController has started merge request[0x00006000031f6720] processing

[20201218 14:04:32.205] MC[6E52:0AEF] [A4FB]: processing get_root message, my hash: E24937F3BD2655F968D89F166FA7B641FD60B888, remote hash E24937F3BD2655F968D89F166FA7B641FD60B888, full_merge: 0

[20201218 14:04:32.261] PeerMsgConn[031F6720]: state changed incoming merge 3

[20201218 14:04:32.261] SF[6E52:0AEF] [A4FB]: State sync finished

[20201218 14:04:32.261] PeerMsgConn[031F6720]: destroyed incoming merge cnt=2

[20201218 14:04:33.676] SF[6E52:0AEF]: recognized incoming PeerMessageConnection

[20201218 14:04:33.676] PeerMsgConn[03161A20]: created incoming merge

[20201218 14:04:33.676] SF[6E52:0AEF] [A4FB]: Received request "id"

[20201218 14:04:33.676] SF[6E52:0AEF] [A4FB]: Got id message from peer MacBook Pro (20F00E584888CCB22A219BF6E6216E920556A4FB) 2.7.2

[20201218 14:04:33.676] SF[6E52:0AEF] [A4FB]: Got state sync request

[20201218 14:04:33.676] PeerMsgConn[03161A20]: state changed incoming merge 1

[20201218 14:04:33.676] SF[6E52:0AEF] [A4FB]: Received request "get_root"

[20201218 14:04:33.676] SF[6E52:0AEF] [A4FB]: ConecurrentMergeController has started merge request[0x0000600003161a20] processing

[20201218 14:04:33.676] MC[6E52:0AEF] [A4FB]: processing get_root message, my hash: E24937F3BD2655F968D89F166FA7B641FD60B888, remote hash E24937F3BD2655F968D89F166FA7B641FD60B888, full_merge: 0

[20201218 14:04:33.738] PeerMsgConn[03161A20]: state changed incoming merge 3

[20201218 14:04:33.738] SF[6E52:0AEF] [A4FB]: State sync finished

[20201218 14:04:33.738] PeerMsgConn[03161A20]: destroyed incoming merge cnt=2

[20201218 14:04:34.241] SF[6E52:0AEF]: UpdatePeersStat

[20201218 14:04:34.241] SF[6E52:0AEF] [A4FB]: up:0 down:0

[20201218 14:04:34.241] SF[6E52:0AEF] [FB7B]: up:0 down:0

[20201218 14:04:34.241] SF[6E52:0AEF]: up_diff:0 down_diff:0 up_speed:0 down_speed:0

[20201218 14:04:34.241] ScheduledTask: "UpdatePeersStat" invoked: timer, reason:FinishStateSync

[20201218 14:04:34.576] SF[6E52:0AEF]: recognized incoming PeerMessageConnection

[20201218 14:04:34.576] PeerMsgConn[03161A20]: created incoming merge

[20201218 14:04:34.576] SF[6E52:0AEF] [A4FB]: Received request "id"

[20201218 14:04:34.576] SF[6E52:0AEF] [A4FB]: Got id message from peer MacBook Pro (20F00E584888CCB22A219BF6E6216E920556A4FB) 2.7.2

[20201218 14:04:34.576] SF[6E52:0AEF] [A4FB]: Got state sync request

[20201218 14:04:34.576] PeerMsgConn[03161A20]: state changed incoming merge 1

[20201218 14:04:34.576] SF[6E52:0AEF] [A4FB]: Received request "get_root"

[20201218 14:04:34.576] SF[6E52:0AEF] [A4FB]: ConecurrentMergeController has started merge request[0x0000600003161a20] processing

[20201218 14:04:34.576] MC[6E52:0AEF] [A4FB]: processing get_root message, my hash: E24937F3BD2655F968D89F166FA7B641FD60B888, remote hash E24937F3BD2655F968D89F166FA7B641FD60B888, full_merge: 0

[20201218 14:04:34.636] PeerMsgConn[03161A20]: state changed incoming merge 3

[20201218 14:04:34.636] SF[6E52:0AEF] [A4FB]: State sync finished

[20201218 14:04:34.636] PeerMsgConn[03161A20]: destroyed incoming merge cnt=2

[20201218 14:04:35.577] SF[6E52:0AEF]: recognized incoming PeerMessageConnection

[20201218 14:04:35.577] PeerMsgConn[0319EC00]: created incoming merge

[20201218 14:04:35.577] SF[6E52:0AEF] [A4FB]: Received request "id"

[20201218 14:04:35.577] SF[6E52:0AEF] [A4FB]: Got id message from peer MacBook Pro (20F00E584888CCB22A219BF6E6216E920556A4FB) 2.7.2

[20201218 14:04:35.577] SF[6E52:0AEF] [A4FB]: Got state sync request

[20201218 14:04:35.577] PeerMsgConn[0319EC00]: state changed incoming merge 1

[20201218 14:04:35.577] SF[6E52:0AEF] [A4FB]: Received request "get_root"

[20201218 14:04:35.577] SF[6E52:0AEF] [A4FB]: ConecurrentMergeController has started merge request[0x000060000319ec00] processing

[20201218 14:04:35.577] MC[6E52:0AEF] [A4FB]: processing get_root message, my hash: E24937F3BD2655F968D89F166FA7B641FD60B888, remote hash E24937F3BD2655F968D89F166FA7B641FD60B888, full_merge: 0

[20201218 14:04:35.634] PeerMsgConn[0319EC00]: state changed incoming merge 3

[20201218 14:04:35.635] SF[6E52:0AEF] [A4FB]: State sync finished

[20201218 14:04:35.635] PeerMsgConn[0319EC00]: destroyed incoming merge cnt=2

[20201218 14:04:36.547] SF[6E52:0AEF]: recognized incoming PeerMessageConnection

[20201218 14:04:36.548] PeerMsgConn[0319EC00]: created incoming merge

[20201218 14:04:36.548] SF[6E52:0AEF] [A4FB]: Received request "id"

[20201218 14:04:36.548] SF[6E52:0AEF] [A4FB]: Got id message from peer MacBook Pro (20F00E584888CCB22A219BF6E6216E920556A4FB) 2.7.2

[20201218 14:04:36.548] SF[6E52:0AEF] [A4FB]: Got state sync request

[20201218 14:04:36.548] PeerMsgConn[0319EC00]: state changed incoming merge 1

[20201218 14:04:36.548] SF[6E52:0AEF] [A4FB]: Received request "get_root"

[20201218 14:04:36.548] SF[6E52:0AEF] [A4FB]: ConecurrentMergeController has started merge request[0x000060000319ec00] processing

[20201218 14:04:36.548] MC[6E52:0AEF] [A4FB]: processing get_root message, my hash: E24937F3BD2655F968D89F166FA7B641FD60B888, remote hash E24937F3BD2655F968D89F166FA7B641FD60B888, full_merge: 0

[20201218 14:04:36.606] PeerMsgConn[0319EC00]: state changed incoming merge 3

[20201218 14:04:36.606] SF[6E52:0AEF] [A4FB]: State sync finished

[20201218 14:04:36.606] PeerMsgConn[0319EC00]: destroyed incoming merge cnt=2

[20201218 14:04:37.147] 16TunnelConnection[0x00007fa63568ccc0]: received ping

[20201218 14:04:37.205] SF[6E52:0AEF]: recognized incoming PeerMessageConnection

[20201218 14:04:37.205] PeerMsgConn[0319EC00]: created incoming merge

[20201218 14:04:37.205] SF[6E52:0AEF] [A4FB]: Received request "id"

[20201218 14:04:37.205] SF[6E52:0AEF] [A4FB]: Got id message from peer MacBook Pro (20F00E584888CCB22A219BF6E6216E920556A4FB) 2.7.2

[20201218 14:04:37.206] SF[6E52:0AEF] [A4FB]: Got state sync request

[20201218 14:04:37.206] PeerMsgConn[0319EC00]: state changed incoming merge 1

[20201218 14:04:37.206] SF[6E52:0AEF] [A4FB]: Received request "get_root"

[20201218 14:04:37.206] SF[6E52:0AEF] [A4FB]: ConecurrentMergeController has started merge request[0x000060000319ec00] processing

[20201218 14:04:37.206] MC[6E52:0AEF] [A4FB]: processing get_root message, my hash: E24937F3BD2655F968D89F166FA7B641FD60B888, remote hash E24937F3BD2655F968D89F166FA7B641FD60B888, full_merge: 0

[20201218 14:04:37.263] PeerMsgConn[0319EC00]: state changed incoming merge 3

[20201218 14:04:37.263] SF[6E52:0AEF] [A4FB]: State sync finished

[20201218 14:04:37.263] PeerMsgConn[0319EC00]: destroyed incoming merge cnt=2

[20201218 14:04:38.626] SF[6E52:0AEF]: recognized incoming PeerMessageConnection

[20201218 14:04:38.626] PeerMsgConn[0319EC00]: created incoming merge

[20201218 14:04:38.626] SF[6E52:0AEF] [A4FB]: Received request "id"

[20201218 14:04:38.626] SF[6E52:0AEF] [A4FB]: Got id message from peer MacBook Pro (20F00E584888CCB22A219BF6E6216E920556A4FB) 2.7.2

[20201218 14:04:38.626] SF[6E52:0AEF] [A4FB]: Got state sync request

[20201218 14:04:38.626] PeerMsgConn[0319EC00]: state changed incoming merge 1

[20201218 14:04:38.626] SF[6E52:0AEF] [A4FB]: Received request "get_root"

[20201218 14:04:38.626] SF[6E52:0AEF] [A4FB]: ConecurrentMergeController has started merge request[0x000060000319ec00] processing

[20201218 14:04:38.626] MC[6E52:0AEF] [A4FB]: processing get_root message, my hash: E24937F3BD2655F968D89F166FA7B641FD60B888, remote hash E24937F3BD2655F968D89F166FA7B641FD60B888, full_merge: 0

[20201218 14:04:38.681] PeerMsgConn[0319EC00]: state changed incoming merge 3

[20201218 14:04:38.681] SF[6E52:0AEF] [A4FB]: State sync finished

[20201218 14:04:38.682] PeerMsgConn[0319EC00]: destroyed incoming merge cnt=2

[20201218 14:04:39.186] SF[6E52:0AEF]: UpdatePeersStat

[20201218 14:04:39.186] SF[6E52:0AEF] [A4FB]: up:0 down:0

[20201218 14:04:39.186] SF[6E52:0AEF] [FB7B]: up:0 down:0

[20201218 14:04:39.186] SF[6E52:0AEF]: up_diff:0 down_diff:0 up_speed:0 down_speed:0

[20201218 14:04:39.186] ScheduledTask: "UpdatePeersStat" invoked: timer, reason:FinishStateSync

[20201218 14:04:39.568] SF[6E52:0AEF]: recognized incoming PeerMessageConnection

[20201218 14:04:39.568] PeerMsgConn[0319EC00]: created incoming merge

[20201218 14:04:39.568] SF[6E52:0AEF] [A4FB]: Received request "id"

[20201218 14:04:39.568] SF[6E52:0AEF] [A4FB]: Got id message from peer MacBook Pro (20F00E584888CCB22A219BF6E6216E920556A4FB) 2.7.2

[20201218 14:04:39.569] SF[6E52:0AEF] [A4FB]: Got state sync request

[20201218 14:04:39.569] PeerMsgConn[0319EC00]: state changed incoming merge 1

[20201218 14:04:39.569] SF[6E52:0AEF] [A4FB]: Received request "get_root"

[20201218 14:04:39.569] SF[6E52:0AEF] [A4FB]: ConecurrentMergeController has started merge request[0x000060000319ec00] processing

[20201218 14:04:39.569] MC[6E52:0AEF] [A4FB]: processing get_root message, my hash: E24937F3BD2655F968D89F166FA7B641FD60B888, remote hash E24937F3BD2655F968D89F166FA7B641FD60B888, full_merge: 0

[20201218 14:04:39.628] PeerMsgConn[0319EC00]: state changed incoming merge 3

[20201218 14:04:39.628] SF[6E52:0AEF] [A4FB]: State sync finished

[20201218 14:04:39.628] PeerMsgConn[0319EC00]: destroyed incoming merge cnt=2

[20201218 14:04:40.456] SF[6E52:0AEF]: recognized incoming PeerMessageConnection

[20201218 14:04:40.456] PeerMsgConn[0319EC00]: created incoming merge

[20201218 14:04:40.456] SF[6E52:0AEF] [A4FB]: Received request "id"

[20201218 14:04:40.456] SF[6E52:0AEF] [A4FB]: Got id message from peer MacBook Pro (20F00E584888CCB22A219BF6E6216E920556A4FB) 2.7.2

[20201218 14:04:40.456] SF[6E52:0AEF] [A4FB]: Got state sync request

[20201218 14:04:40.456] PeerMsgConn[0319EC00]: state changed incoming merge 1

[20201218 14:04:40.456] SF[6E52:0AEF] [A4FB]: Received request "get_root"

[20201218 14:04:40.456] SF[6E52:0AEF] [A4FB]: ConecurrentMergeController has started merge request[0x000060000319ec00] processing

[20201218 14:04:40.457] MC[6E52:0AEF] [A4FB]: processing get_root message, my hash: E24937F3BD2655F968D89F166FA7B641FD60B888, remote hash E24937F3BD2655F968D89F166FA7B641FD60B888, full_merge: 0

[20201218 14:04:40.518] PeerMsgConn[0319EC00]: state changed incoming merge 3

[20201218 14:04:40.518] SF[6E52:0AEF] [A4FB]: State sync finished

[20201218 14:04:40.518] PeerMsgConn[0319EC00]: destroyed incoming merge cnt=2

[20201218 14:04:41.365] SF[6E52:0AEF]: recognized incoming PeerMessageConnection

[20201218 14:04:41.365] PeerMsgConn[0319EC00]: created incoming merge

[20201218 14:04:41.366] SF[6E52:0AEF] [A4FB]: Received request "id"

[20201218 14:04:41.366] SF[6E52:0AEF] [A4FB]: Got id message from peer MacBook Pro (20F00E584888CCB22A219BF6E6216E920556A4FB) 2.7.2

[20201218 14:04:41.366] SF[6E52:0AEF] [A4FB]: Got state sync request

[20201218 14:04:41.366] PeerMsgConn[0319EC00]: state changed incoming merge 1

[20201218 14:04:41.366] SF[6E52:0AEF] [A4FB]: Received request "get_root"

[20201218 14:04:41.366] SF[6E52:0AEF] [A4FB]: ConecurrentMergeController has started merge request[0x000060000319ec00] processing

[20201218 14:04:41.366] MC[6E52:0AEF] [A4FB]: processing get_root message, my hash: E24937F3BD2655F968D89F166FA7B641FD60B888, remote hash E24937F3BD2655F968D89F166FA7B641FD60B888, full_merge: 0

[20201218 14:04:41.426] PeerMsgConn[0319EC00]: state changed incoming merge 3

[20201218 14:04:41.426] SF[6E52:0AEF] [A4FB]: State sync finished

[20201218 14:04:41.426] PeerMsgConn[0319EC00]: destroyed incoming merge cnt=2

[20201218 14:04:41.932] SYS_RES: drive "/", id: 16777235, capacity: 84959744000, free_space: 73709518848

[20201218 14:04:41.934] SYS_RES: drive "/private/var/vm", id: 16777238, capacity: 105923878912, free_space: 73709518848

[20201218 14:04:41.935] SYS_RES: drive "/Volumes/Apricorn", id: 16777245, capacity: 499763888128, free_space: 499315658752

[20201218 14:04:41.935] SYS_RES: drive "/Volumes/Working", id: 16777247, capacity: 999345127424, free_space: 440095072256

[20201218 14:04:41.936] SYS_RES: drive "/System/Volumes/Data/home", id: 855638017, capacity: 0, free_space: 0

[20201218 14:04:41.937] SYS_RES: drive "/Volumes/Media", id: 788529154, capacity: 15421989031936, free_space: 11972280827904

[20201218 14:04:41.939] SYS_RES: drive "/Volumes/scott", id: 872415245, capacity: 58011566080, free_space: 34901999616

[20201218 14:04:41.940] SYS_RES: drive "/Volumes/.timemachine/Time Capsule._afpovertcp._tcp.local/67D7AB79-AE28-4A00-8778-678E1206904F/Time Capsule", id: 889192652, capacity: 1998251409408, free_space: 1069054021632

[20201218 14:04:42.274] SF[0BF2:0AEF]: recognized incoming PeerMessageConnection

[20201218 14:04:42.275] PeerMsgConn[0319EC00]: created incoming merge

[20201218 14:04:42.275] SF[0BF2:0AEF] [A4FB]: Received request "id"

[20201218 14:04:42.275] SF[0BF2:0AEF] [A4FB]: Got id message from peer MacBook Pro (20F00E584888CCB22A219BF6E6216E920556A4FB) 2.7.2

[20201218 14:04:42.275] SF[0BF2:0AEF] [A4FB]: Got state sync request

[20201218 14:04:42.275] PeerMsgConn[0319EC00]: state changed incoming merge 1

[20201218 14:04:42.275] SF[0BF2:0AEF] [A4FB]: Received request "get_root"

[20201218 14:04:42.275] SF[0BF2:0AEF] [A4FB]: ConecurrentMergeController has started merge request[0x000060000319ec00] processing

[20201218 14:04:42.275] MC[0BF2:0AEF] [A4FB]: processing get_root message, my hash: 7ADDD0FD82720106E0C7F4EF4C1B09D4E893CC57, remote hash 1AEA82EEDEBDDF5DF66633064E1BCDAE92CC91BD, full_merge: 0

[20201218 14:04:42.275] SF[6E52:0AEF]: recognized incoming PeerMessageConnection

[20201218 14:04:42.275] PeerMsgConn[0319E3E0]: created incoming merge

[20201218 14:04:42.275] SF[6E52:0AEF] [A4FB]: Received request "id"

[20201218 14:04:42.275] SF[6E52:0AEF] [A4FB]: Got id message from peer MacBook Pro (20F00E584888CCB22A219BF6E6216E920556A4FB) 2.7.2

[20201218 14:04:42.275] SF[6E52:0AEF] [A4FB]: Got state sync request

[20201218 14:04:42.275] PeerMsgConn[0319E3E0]: state changed incoming merge 1

[20201218 14:04:42.275] SF[6E52:0AEF] [A4FB]: Received request "get_root"

[20201218 14:04:42.275] SF[6E52:0AEF] [A4FB]: ConecurrentMergeController has started merge request[0x000060000319e3e0] processing

[20201218 14:04:42.275] MC[6E52:0AEF] [A4FB]: processing get_root message, my hash: E24937F3BD2655F968D89F166FA7B641FD60B888, remote hash E24937F3BD2655F968D89F166FA7B641FD60B888, full_merge: 0

[20201218 14:04:42.333] SF[0BF2:0AEF] [A4FB]: Received request "files"

[20201218 14:04:42.333] MC[0BF2:0AEF] [A4FB]: processing files message with 2 files

[20201218 14:04:42.333] FC[0BF2:0AEF]: got 2 files from remote (192.168.1.51:58100)

[20201218 14:04:42.333] SF[0BF2:0AEF] [A4FB]: State sync finished

[20201218 14:04:42.333] PeerMsgConn[0319EC00]: destroyed incoming merge cnt=3

[20201218 14:04:42.333] SF[0BF2:0AEF]: UpdatePeersStat

[20201218 14:04:42.333] SF[0BF2:0AEF] [A4FB]: up:0 down:0

[20201218 14:04:42.333] SF[0BF2:0AEF]: up_diff:0 down_diff:0 up_speed:0 down_speed:0

[20201218 14:04:42.333] ScheduledTask: "UpdatePeersStat" invoked: immediately, reason:FinishStateSync

[20201218 14:04:42.333] FC[0BF2:0AEF]: Setup entry job "CheckMutexJob" for path "", next state is "PERFORM_DISK", running 1/0, queue size 0 0 0 0

[20201218 14:04:42.333] ScheduledTask: "CheckMutex" invoked: immediately, reason:files from remote

[20201218 14:04:42.333] PeerMsgConn[0319E3E0]: state changed incoming merge 3

[20201218 14:04:42.333] SF[6E52:0AEF] [A4FB]: State sync finished

[20201218 14:04:42.333] PeerMsgConn[0319E3E0]: destroyed incoming merge cnt=2

[20201218 14:04:42.334] FC[0BF2:0AEF]: got file from remote: {"ctime":1560786760,"dl_failed":false,"exists_on_disk":false,"file_hash":"2065BDC275942CA5EB467341FD0D185EEA4CFF44","file_id":"0:0","flags":12,"force_update":false,"fs_error_type":0,"has_remote_copy":false,"have_pieces":2,"ignored":false,"info_hash":"941A96BE79D8A1EAA83293769CFCE59FA488C4DC","invalidated":false,"link_content":"","mtime":1560786760,"name_on_disk":"Paystub 5-24.pdf","otime":2794,"owner":"20F00E584888CCB22A219BF6E6216E920556A4FB","path":"/Users/scott/Downloads/Paystub 5-24.pdf","pending_disk_operation":false,"perm":420,"ph_ext":".rslsf","placeholder":false,"pvi":"pvi[NULL]","rctime":-1,"rmtime":-1,"select_children_for_dl":false,"selected_for_dl":true,"size":62311,"state":1,"time":1560786760,"total_pieces":2,"type":1,"waiting_full_index_from_remote":false}

[20201218 14:04:42.334] Update have pieces for entry "/Users/scott/Downloads/Paystub 5-24.pdf", was: 2, now: 0

[20201218 14:04:42.334] FC[0BF2:0AEF]: won't perform job for entry "Paystub 5-24.pdf" with known state pvi[NULL]

[20201218 14:04:42.334] FC[0BF2:0AEF]: Setup entry job "FileEntryJob" for path "Paystub 5-24.pdf", next state is "COMPLETE", running 1/0, queue size 0 1 0 0

[20201218 14:04:42.334] Set new pvinfo for file "/Users/scott/Downloads/Paystub 5-24.pdf" = pvi[NULL]

[20201218 14:04:42.334] FC[0BF2:0AEF]: remote entry job complete for entry (result = 1) "{"ctime":1560786760,"dl_failed":false,"exists_on_disk":false,"file_hash":"2065BDC275942CA5EB467341FD0D185EEA4CFF44","file_id":"0:0","flags":2060,"force_update":false,"fs_error_type":0,"has_remote_copy":true,"have_pieces":0,"ignored":false,"info_hash":"941A96BE79D8A1EAA83293769CFCE59FA488C4DC","invalidated":false,"link_content":"","mtime":1560786760,"name_on_disk":"Paystub 5-24.pdf","otime":2794,"owner":"20F00E584888CCB22A219BF6E6216E920556A4FB","path":"/Users/scott/Downloads/Paystub 5-24.pdf","pending_disk_operation":false,"perm":420,"ph_ext":".rslsf","placeholder":false,"pvi":"pvi[NULL]","rctime":-1,"rmtime":-1,"select_children_for_dl":false,"selected_for_dl":true,"size":62311,"state":1,"time":1560786760,"total_pieces":2,"type":1,"waiting_full_index_from_remote":false}"

[20201218 14:04:42.335] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: created

[20201218 14:04:42.335] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: aggregation=0, range_span=0, piece_size=32768, have=0/2

[20201218 14:04:42.335] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: change state from "INVALID" to "LOAD"

[20201218 14:04:42.335] FC[0BF2:0AEF]: Setup entry job "LoadMetadataJob" for path "", next state is "PERFORM_DISK", running 0/1, queue size 0 1 0 0

[20201218 14:04:42.335] TC: change prio from -2147483648 to 0 (tf load)

[20201218 14:04:42.335] SF[0BF2:0AEF] [A4FB]: Going to connect to peer 192.168.1.51:58100 for file "/Users/scott/Downloads/Paystub 5-24.pdf"

[20201218 14:04:42.335] PC[0x00007fa6354cc808][0x0000000000000000] created

[20201218 14:04:42.335] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: Add PC[0x00007fa6354cc808] to pending - pending count: 0

[20201218 14:04:42.335] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: Opened outgoing PC[0x00007fa6354cc808]

[20201218 14:04:42.335] SP[A4FB] AddToDownloading index = 4188

[20201218 14:04:42.335] SF[0BF2:0AEF] [A4FB]: connect files to peer, queue:0 dowloading:1/62311 limit:1048576 speed:5036

[20201218 14:04:42.335] ScheduledTask: "ConnectMorePeers" invoked: immediately, reason:OnFileWantsDownload

[20201218 14:04:42.336] SF[0BF2:0AEF] [A4FB]: Going to send state notify to peer 192.168.1.51:58100 - root:EE300DE39EF64CEE26792D02831CFD1FC05C18FB pieces:3D689EB3C2103D4FA0B5057E78C1A1CCC1B1B014

[20201218 14:04:42.336] PeerMsgConn[031E1A20]: created state notify

[20201218 14:04:42.336] ScheduledTask: "StateNotify" invoked: immediately, reason:OnLocalTreeChanged

[20201218 14:04:42.336] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: change state from "LOAD" to "LOADED"

[20201218 14:04:42.336] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: change state from "LOADED" to "REC_METADATA"

[20201218 14:04:42.336] FC[0BF2:0AEF]: got file from remote: {"ctime":-1,"dl_failed":false,"exists_on_disk":false,"file_hash":"D5686213105E45C2EC3CCE6393372505F2ADA907","file_id":"0:0","flags":12,"force_update":false,"fs_error_type":0,"has_remote_copy":false,"have_pieces":1,"ignored":false,"info_hash":"7B8802AB1C177F4831C2FD80EDC112B06AEA39BD","invalidated":false,"link_content":"","mtime":-1,"name_on_disk":"com.apple.metadata:_kMDItemUserTags","otime":2795,"owner":"20F00E584888CCB22A219BF6E6216E920556A4FB","path":"/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags","pending_disk_operation":false,"perm":0,"ph_ext":".rsls","placeholder":false,"pvi":"pvi[NULL]","rctime":-1,"rmtime":-1,"select_children_for_dl":false,"selected_for_dl":true,"size":42,"state":1,"time":1560786760,"total_pieces":1,"type":5,"waiting_full_index_from_remote":false}

[20201218 14:04:42.336] Update have pieces for entry "/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags", was: 1, now: 0

[20201218 14:04:42.336] FC[0BF2:0AEF]: Setup entry job "FileEntryJob" for path "Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags", next state is "PERFORM_DISK", running 1/0, queue size 0 0 0 0

[20201218 14:04:42.337] FC[0BF2:0AEF]: file entry job for entry "{"ctime":-1,"dl_failed":false,"exists_on_disk":false,"file_hash":"D5686213105E45C2EC3CCE6393372505F2ADA907","file_id":"0:0","flags":2124,"force_update":false,"fs_error_type":0,"has_remote_copy":true,"have_pieces":0,"ignored":false,"info_hash":"7B8802AB1C177F4831C2FD80EDC112B06AEA39BD","invalidated":false,"link_content":"","mtime":-1,"name_on_disk":"com.apple.metadata:_kMDItemUserTags","otime":2795,"owner":"20F00E584888CCB22A219BF6E6216E920556A4FB","path":"/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags","pending_disk_operation":true,"perm":0,"ph_ext":".rsls","placeholder":false,"pvi":"pvi[NULL]","rctime":-1,"rmtime":-1,"select_children_for_dl":false,"selected_for_dl":true,"size":42,"state":1,"time":1560786760,"total_pieces":1,"type":5,"waiting_full_index_from_remote":false}"

[20201218 14:04:42.337] Set new pvinfo for file "/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags" = pvi[NULL]

[20201218 14:04:42.337] FC[0BF2:0AEF]: remote entry job complete for entry (result = 1) "{"ctime":-1,"dl_failed":false,"exists_on_disk":false,"file_hash":"D5686213105E45C2EC3CCE6393372505F2ADA907","file_id":"0:0","flags":2060,"force_update":false,"fs_error_type":0,"has_remote_copy":true,"have_pieces":0,"ignored":false,"info_hash":"7B8802AB1C177F4831C2FD80EDC112B06AEA39BD","invalidated":false,"link_content":"","mtime":-1,"name_on_disk":"com.apple.metadata:_kMDItemUserTags","otime":2795,"owner":"20F00E584888CCB22A219BF6E6216E920556A4FB","path":"/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags","pending_disk_operation":false,"perm":0,"ph_ext":".rsls","placeholder":false,"pvi":"pvi[NULL]","rctime":-1,"rmtime":-1,"select_children_for_dl":false,"selected_for_dl":true,"size":42,"state":1,"time":1560786760,"total_pieces":1,"type":5,"waiting_full_index_from_remote":false}"

[20201218 14:04:42.396] PC[0x00007fa6354cc808][0x00007fa6368c5a00] send login - peer:200081498FC19820D8025F7E1B54CEFC02EA0AEF share:F82E2A1BE4311C4EC1F73613160EB34E85F20BF2 info:941A96BE79D8A1EAA83293769CFCE59FA488C4DC file:"Paystub 5-24.pdf"

[20201218 14:04:42.396] PeerMsgConn[031E1A20]: state changed state notify 1

[20201218 14:04:42.396] SF[0BF2:0AEF] [A4FB]: connected

[20201218 14:04:42.396] PeerMsgConn[031E1A20]: destroyed state notify cnt=0

[20201218 14:04:42.455] 16TunnelConnection[0x00007fa63568ccc0]: got packet 4 for unknown connection id=1998297637

[20201218 14:04:42.455] PC[0x00007fa6354cc808][0x00007fa6368c5a00] got login - info:941A96BE79D8A1EAA83293769CFCE59FA488C4DC file:"Paystub 5-24.pdf"

[20201218 14:04:42.455] PC[0x00007fa6354cc808][0x00007fa6368c5a00] Handshake completed

[20201218 14:04:42.455] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: got metadata size 104, pieces 1

[20201218 14:04:42.455] PC[0x00007fa6354cc808][0x00007fa6368c5a00] Requesting metadata 0/1

[20201218 14:04:42.516] PC[0x00007fa6354cc808][0x00007fa6368c5a00] Reading msg 1 piece 0

[20201218 14:04:42.516] PC[0x00007fa6354cc808][0x00007fa6368c5a00] Got metadata 0/1

[20201218 14:04:42.516] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: parse meta - piece hash size = 20

[20201218 14:04:42.516] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: finished receiving metadata

[20201218 14:04:42.516] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: metadata loaded for file "/Users/scott/Downloads/Paystub 5-24.pdf", setting up download type

[20201218 14:04:42.516] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: change state from "REC_METADATA" to "RECHECK"

[20201218 14:04:42.517] FSTORAGE: Opened handle 18 - "/Users/scott/Downloads/.sync/D51B2D9B297100D9CE7BB4E6502DF041ACC0F7EC.!sync"

[20201218 14:04:42.517] FSTORAGE: Closed handle 18 - "/Users/scott/Downloads/.sync/D51B2D9B297100D9CE7BB4E6502DF041ACC0F7EC.!sync"

[20201218 14:04:42.517] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: change state from "RECHECK" to "LOOKUP_LOCAL_COPY"

[20201218 14:04:42.517] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: change state from "LOOKUP_LOCAL_COPY" to "DOWNLOAD"

[20201218 14:04:42.517] PC[0x00007fa6354cc808][0x00007fa6368c5a00] pending:0 requests:0 unwirtten:0

[20201218 14:04:42.517] PC[0x00007fa6354cc808][0x00007fa6368c5a00] interested: true

[20201218 14:04:42.517] PC[0x00007fa6354cc808][0x00007fa6368c5a00] interested: false

[20201218 14:04:42.517] PC[0x00007fa6354cc808][0x00007fa6368c5a00] Requesting 0:0->32768 pending:1/0

[20201218 14:04:42.517] PC[0x00007fa6354cc808][0x00007fa6368c5a00] Requesting 1:0->29543 pending:2/0

[20201218 14:04:42.517] SP[A4FB] AddToDownloading index = 4188

[20201218 14:04:42.517] SP[A4FB] RemoveFromDownloading index = 4188

[20201218 14:04:42.579] PC[0x00007fa6354cc808][0x00007fa6368c5a00] Got Piece: 0:0->32768 rtt:61980

[20201218 14:04:42.579] PC[0x00007fa6354cc808][0x00007fa6368c5a00] speed:527750/527750 rtt:62090/62090 pend:1055500

[20201218 14:04:42.579] PC[0x00007fa6354cc808][0x00007fa6368c5a00] interested: true

[20201218 14:04:42.579] SP[A4FB] AddToDownloading index = 4188

[20201218 14:04:42.579] FSTORAGE: Opened handle 18 - "/Users/scott/Downloads/.sync/D51B2D9B297100D9CE7BB4E6502DF041ACC0F7EC.!sync"

[20201218 14:04:42.580] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: piece 0 complete (downloaded) disk:0% mt:0% net: 0% dl:62 t:62 c:32 A4FB:62

[20201218 14:04:42.580] Update have pieces for entry "/Users/scott/Downloads/Paystub 5-24.pdf", was: 0, now: 1

[20201218 14:04:42.580] PC[0x00007fa6354cc808][0x00007fa6368c5a00] Got Piece: 1:0->29543 rtt:63129

[20201218 14:04:42.580] PC[0x00007fa6354cc808][0x00007fa6368c5a00] speed:986511/986511 rtt:63163/62090 pend:1973022

[20201218 14:04:42.580] PC[0x00007fa6354cc808][0x00007fa6368c5a00] interested: false

[20201218 14:04:42.580] SP[A4FB] RemoveFromDownloading index = 4188

[20201218 14:04:42.580] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: piece 1 complete (downloaded) disk:0% mt:0% net: 0% dl:63 t:63 c:32 A4FB:63

[20201218 14:04:42.581] PC[0x00007fa6354cc808][0x00007fa6368c5a00] disconnect - reason: "Is seed", error: 0)

[20201218 14:04:42.581] PC[0x00007fa6354cc808][0x0000000000000000] deleted

[20201218 14:04:42.581] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: change state from "DOWNLOAD" to "POST_DOWNLOAD_WORK"

[20201218 14:04:42.581] SP[A4FB] RemoveFromDownloading index = 4188

[20201218 14:04:42.581] FSTORAGE: Closed handle 18 - "/Users/scott/Downloads/.sync/D51B2D9B297100D9CE7BB4E6502DF041ACC0F7EC.!sync"

[20201218 14:04:42.581] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: removing torrent for file: work complete, io: 1

[20201218 14:04:42.581] FC[0BF2:0AEF]: torrent finished "/Users/scott/Downloads/Paystub 5-24.pdf"

[20201218 14:04:42.581] FC[0BF2:0AEF]: Check fs duplicates, original: /Users/scott/Downloads/Paystub 5-24.pdf (1 1)

[20201218 14:04:42.582] FC[0BF2:0AEF]: assign file_id 16777235:149708672 to entry with path "/Users/scott/Downloads/Paystub 5-24.pdf"

[20201218 14:04:42.582] FC[0BF2:0AEF]: Finished post-download-work for entry "/Users/scott/Downloads/Paystub 5-24.pdf", result: 1

[20201218 14:04:42.582] Finished downloading file "/Users/scott/Downloads/Paystub 5-24.pdf"

[20201218 14:04:42.582] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: check can delete: fs_refs = 0

[20201218 14:04:42.582] TC: change prio from 0 to -2147483648 (tf unload)

[20201218 14:04:42.582] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: unloading up:0/0 down:62311

[20201218 14:04:42.583] TF[0BF2:0AEF] [0x00007fa6368c5a00][/Users/scott/Downloads/Paystub 5-24.pdf]: deleted

[20201218 14:04:42.640] 16TunnelConnection[0x00007fa63568ccc0]: got packet 4 for unknown connection id=1998297636

[20201218 14:04:43.144] TF[0BF2:0AEF] [0x00007fa636183000][/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags]: created

[20201218 14:04:43.144] TF[0BF2:0AEF] [0x00007fa636183000][/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags]: aggregation=0, range_span=0, piece_size=1024, have=0/1

[20201218 14:04:43.144] TF[0BF2:0AEF] [0x00007fa636183000][/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags]: change state from "INVALID" to "LOAD"

[20201218 14:04:43.144] TF[0BF2:0AEF] [0x00007fa636183000][/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags]: parse meta - piece hash size = 20

[20201218 14:04:43.144] TF[0BF2:0AEF] [0x00007fa636183000][/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags]: change state from "LOAD" to "LOADED"

[20201218 14:04:43.144] TF[0BF2:0AEF] [0x00007fa636183000][/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags]: change state from "LOADED" to "RECHECK"

[20201218 14:04:43.144] TC: change prio from -2147483648 to 0 (tf load)

[20201218 14:04:43.144] SF[0BF2:0AEF] [A4FB]: Going to connect to peer 192.168.1.51:58100 for file "/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags"

[20201218 14:04:43.144] PC[0x00007fa6357cd2f8][0x0000000000000000] created

[20201218 14:04:43.144] TF[0BF2:0AEF] [0x00007fa636183000][/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags]: Add PC[0x00007fa6357cd2f8] to pending - pending count: 0

[20201218 14:04:43.144] TF[0BF2:0AEF] [0x00007fa636183000][/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags]: Opened outgoing PC[0x00007fa6357cd2f8]

[20201218 14:04:43.144] SP[A4FB] AddToDownloading index = 4189

[20201218 14:04:43.144] SF[0BF2:0AEF] [A4FB]: connect files to peer, queue:0 dowloading:1/42 limit:1048576 speed:5036

[20201218 14:04:43.144] ScheduledTask: "ConnectMorePeers" invoked: timer, reason:OnTorrentUnloaded

[20201218 14:04:43.145] TF[0BF2:0AEF] [0x00007fa636183000][/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags]: state:RECHECK error: meta:1 conns:1 io:1 disk:0% mt:0% net: 0%

[20201218 14:04:43.145] TF[0BF2:0AEF] [0x00007fa636183000][/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags]: change state from "RECHECK" to "LOOKUP_LOCAL_COPY"

[20201218 14:04:43.145] TF[0BF2:0AEF] [0x00007fa636183000][/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags]: change state from "LOOKUP_LOCAL_COPY" to "DOWNLOAD"

[20201218 14:04:43.156] PC[0x00007fa6357cd2f8][0x00007fa636183000] send login - peer:200081498FC19820D8025F7E1B54CEFC02EA0AEF share:F82E2A1BE4311C4EC1F73613160EB34E85F20BF2 info:7B8802AB1C177F4831C2FD80EDC112B06AEA39BD file:"Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags"

[20201218 14:04:43.215] PC[0x00007fa6357cd2f8][0x00007fa636183000] got login - info:7B8802AB1C177F4831C2FD80EDC112B06AEA39BD file:"Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags"

[20201218 14:04:43.215] PC[0x00007fa6357cd2f8][0x00007fa636183000] Handshake completed

[20201218 14:04:43.215] PC[0x00007fa6357cd2f8][0x00007fa636183000] interested: true

[20201218 14:04:43.215] PC[0x00007fa6357cd2f8][0x00007fa636183000] interested: false

[20201218 14:04:43.215] PC[0x00007fa6357cd2f8][0x00007fa636183000] Requesting 0:0->42 pending:1/0

[20201218 14:04:43.215] SP[A4FB] AddToDownloading index = 4189

[20201218 14:04:43.215] SP[A4FB] RemoveFromDownloading index = 4189

[20201218 14:04:43.215] SF[6E52:0AEF]: recognized incoming PeerMessageConnection

[20201218 14:04:43.215] PeerMsgConn[0319DE30]: created incoming merge

[20201218 14:04:43.215] SF[6E52:0AEF] [A4FB]: Received request "id"

[20201218 14:04:43.215] SF[6E52:0AEF] [A4FB]: Got id message from peer MacBook Pro (20F00E584888CCB22A219BF6E6216E920556A4FB) 2.7.2

[20201218 14:04:43.215] SF[6E52:0AEF] [A4FB]: Got state sync request

[20201218 14:04:43.215] PeerMsgConn[0319DE30]: state changed incoming merge 1

[20201218 14:04:43.215] SF[6E52:0AEF] [A4FB]: Received request "get_root"

[20201218 14:04:43.216] SF[6E52:0AEF] [A4FB]: ConecurrentMergeController has started merge request[0x000060000319de30] processing

[20201218 14:04:43.216] MC[6E52:0AEF] [A4FB]: processing get_root message, my hash: E24937F3BD2655F968D89F166FA7B641FD60B888, remote hash E24937F3BD2655F968D89F166FA7B641FD60B888, full_merge: 0

[20201218 14:04:43.271] PC[0x00007fa6357cd2f8][0x00007fa636183000] Got Piece: 0:0->42 rtt:56331

[20201218 14:04:43.271] PC[0x00007fa6357cd2f8][0x00007fa636183000] speed:744/744 rtt:56421/56421 pend:1048576

[20201218 14:04:43.271] PeerMsgConn[0319DE30]: state changed incoming merge 3

[20201218 14:04:43.271] SF[6E52:0AEF] [A4FB]: State sync finished

[20201218 14:04:43.271] PeerMsgConn[0319DE30]: destroyed incoming merge cnt=2

[20201218 14:04:43.272] FSTORAGE: Opened handle 18 - "/Users/scott/Downloads/.sync/1CCA04C92166D0CDFF95204871B03786B275AFAE.!sync"

[20201218 14:04:43.272] TF[0BF2:0AEF] [0x00007fa636183000][/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags]: piece 0 complete (downloaded) disk:0% mt:0% net: 0% dl:56 t:57 c:32 A4FB:56

[20201218 14:04:43.273] PC[0x00007fa6357cd2f8][0x00007fa636183000] disconnect - reason: "Is seed", error: 0)

[20201218 14:04:43.273] PC[0x00007fa6357cd2f8][0x0000000000000000] deleted

[20201218 14:04:43.273] TF[0BF2:0AEF] [0x00007fa636183000][/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags]: change state from "DOWNLOAD" to "POST_DOWNLOAD_WORK"

[20201218 14:04:43.273] SP[A4FB] RemoveFromDownloading index = 4189

[20201218 14:04:43.273] FSTORAGE: Closed handle 18 - "/Users/scott/Downloads/.sync/1CCA04C92166D0CDFF95204871B03786B275AFAE.!sync"

[20201218 14:04:43.273] TF[0BF2:0AEF] [0x00007fa636183000][/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags]: removing torrent for file: work complete, io: 1

[20201218 14:04:43.273] FC[0BF2:0AEF]: torrent finished "/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags"

[20201218 14:04:43.274] FC[0BF2:0AEF]: applying stream "/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags" to file "/Users/scott/Downloads/Paystub 5-24.pdf"

[20201218 14:04:43.274] FC[0BF2:0AEF]: CopyFrom: "/Users/scott/Downloads/.sync/1CCA04C92166D0CDFF95204871B03786B275AFAE.!sync" "/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags"

[20201218 14:04:43.274] FC[0BF2:0AEF]: Finished post-download-work for entry "/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags", result: 1

[20201218 14:04:43.274] Finished downloading file "/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags"

[20201218 14:04:43.274] TF[0BF2:0AEF] [0x00007fa636183000][/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags]: check can delete: fs_refs = 0

[20201218 14:04:43.274] TC: change prio from 0 to -2147483648 (tf unload)

[20201218 14:04:43.274] TF[0BF2:0AEF] [0x00007fa636183000][/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags]: unloading up:0/0 down:42

[20201218 14:04:43.274] TF[0BF2:0AEF] [0x00007fa636183000][/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags]: deleted

[20201218 14:04:43.332] 16TunnelConnection[0x00007fa63568ccc0]: got packet 4 for unknown connection id=1998297638

[20201218 14:04:43.837] SF[6E52:0AEF]: UpdatePeersStat

[20201218 14:04:43.837] SF[6E52:0AEF] [A4FB]: up:0 down:0

[20201218 14:04:43.837] SF[6E52:0AEF] [FB7B]: up:0 down:0

[20201218 14:04:43.837] SF[6E52:0AEF]: up_diff:0 down_diff:0 up_speed:0 down_speed:0

[20201218 14:04:43.837] ScheduledTask: "UpdatePeersStat" invoked: timer, reason:FinishStateSync

[20201218 14:04:43.837] ScheduledTask: "ConnectMorePeers" invoked: timer, reason:OnTorrentUnloaded

[20201218 14:04:43.838] FC[0BF2:0AEF]: processing alternate stream "com.apple.metadata:_kMDItemUserTags" for file "/Users/scott/Downloads/Paystub 5-24.pdf"

[20201218 14:04:43.838] FC[0BF2:0AEF]: Setup entry job "NewEntryJob" for path "Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags", next state is "PERFORM_DISK", running 1/0, queue size 0 0 0 0

[20201218 14:04:43.838] FC[0BF2:0AEF]: tf completed for "/Users/scott/Downloads/Paystub 5-24.pdf/com.apple.metadata:_kMDItemUserTags" - avg hash speed: <unknown>, file hash: D5686213105E45C2EC3CCE6393372505F2ADA907
 
Even better news, as long as the debug preferences stays set.

Since the AppleScript will be calling a 'grep' shell command I don't see any issues with it reading an active log file.

Whenever you get a chance put this code in Script Editor and run. When prompted choose your log file and then when prompted enter a file name you have uploaded or are in the process of uploading (Case sensitive). It will report back (or should) whether the file has been downloaded or not.

AppleScript:
--displays a choose file dialog box to navigate to the desired file to search and stores it to a variable
set theLogFile to choose file with prompt "Please select the Resilio Sync Log File:"

--displays a text entry dialog to receive text to search for and stores it to a variable
set theResponse to display dialog "Enter a Filename to initiate the log search:" default answer "" with icon note buttons {"Cancel", "Continue"} default button "Continue"

--Stores just the text returned from the previous dialog box to a variable
set theFileQuery to text returned of theResponse

--Sets the text string we are matching in the log file with the uploaded file
set theLogResult to "Finished Downloading"


try
--call a shell command for grep to search the chosen log file with the filename entered
    set theLogSearchResult to (do shell script "grep " & the quoted form of theFileQuery & " " & (the POSIX path of theLogFile))
--if no text with the filename is found it displays a dialog informing you of such and then quits the script
on error
    display alert theFileQuery & " was not found in " & (name of (info for (the POSIX path of theLogFile)))
    error number -128
end try
--if grep finds the filename in the log file, it returns all the lines with the filename in it and AppleScript searches for the 'Finished Downloading' text 
if theLogSearchResult contains theLogResult then
--Dipslays an alert that it found the desired text. (This would be replaced with AppleScript changing the files label in the final script) 
    display alert theFileQuery & " has finished downloading"
--Displays a dialog if the desired text is not found. This result would mean the file is still uploading since the filename is in the log but 'Finished Downloading' hasn't been logged yet.
else
    display alert theFileQuery & " has not finished downloading"
end if
 
Hi,
Sorry it took me a few days. Not been feeling well.

I took the script and ran it. It asked for the log file and then the file name, but could not find the file mentioned in the log name. I pulled up the log file manually and looked, and the line was written so I'm not sure why it didn't find it. I took a screenshot of the message with the log in the background and the pertinent line highlighted. I used a screen recording as it was ~68 MB so it would take a bit longer to get there than a 3KB file. Either way, it's Wireless N, so it's still not going to take that long.

Thanks for helping me with this. I'm just sorry I had to take a few days to get to it.

Screen Shot 2020-12-22 at 2.02.12 PM.png
 
Ok, I noticed an error in my script that didn't account for passing invalid characters to the shell. Most likely grep is erroring out on spaces in the file path. So fixed that and am reposting the code. Try the new code but first make sure the 'Show Log' icon is selected in the bottom of the script window (see screenshot). This will log all the results/errors for debugging.

AppleScript:
set theLogFile to choose file with prompt "Please select the Resilio Sync Log File:"

set theResponse to display dialog "Enter a Filename to initiate the log search:" default answer "" with icon note buttons {"Cancel", "Continue"} default button "Continue"

set theFileQuery to text returned of theResponse

set theLogResult to "Finished Downloading"

try
    set theLogSearchResult to (do shell script "grep " & the quoted form of theFileQuery & " " & (the quoted form of (the POSIX path of theLogFile)))
on error
    display alert theFileQuery & " was not found in " & (name of (info for (the POSIX path of theLogFile)))
    error number -128
end try

if theLogSearchResult contains theLogResult then
    display alert theFileQuery & " has finished downloading"
else
    display alert theFileQuery & " has not finished downloading"
end if

Screen Shot 2020-12-23 at 9.33.22 AM.png
 
Cool, so based on that we can start adding some more functionality to this script. First thing that comes to mind is the ability to read the names of the files in the upload folder and check their status in the log file and then change their Finder label accordingly so that Hazel can process them. Let me know, and I can make that addition.
 
That sounds like what I need. There’s a folder on a 1TB drive that Resilio Sync copies everything too. The HD is simply called Working because its only use is for things that I’m currently working on. That way my main system drive and my library array keep their reads and writes lower. The Working hard drive is my oldest drive so I let it take all the read and write cycles and when everything is done, Hazel will move it to the library array.

If the script that watch that folder and compare any non labeled files with the sync log, that would work out beautifully. I can make a Hazel rule that would only run if the label was on it. If the script can’t be worked into a folder action (I know Automator lets you insert AppleScript into the workflows for apps and services, but I’m not sure if it lets you do that with folder actions), then I could have the script scheduled to run every few minutes or something? I know Linux calls them cron jobs, not sure if macOS has a different name.

But yeah, your suggestion seems to be exactly what I need. I just don’t know if it can be put inside a folder action workflow or if I can just schedule it. Another option is Hazel. Hazel does allow AppleScript to be part of the rule:

Screen Shot 2020-12-23 at 3.19.59 PM.png
 
Ok, I'm back.

The problem with Folder Actions (besides not always being reliable) is that they run when something has been added to the folder (not finished copying) so the script would need to be running the whole time the file is uploading (Basically just checking the file size every x seconds until it stops expanding). While hypothetically possible, I wouldn't count on it always being reliable, especially if your upload is interrupted....gets messy.

As you mentioned, having an AppleScript run every x minutes via launchd (Apple recommends launchd over cron) is probably the way to go.

I'd probably recommend having the launchd script just check if the file is finished uploading and then label the file and then have Hazel run (can Hazel activate on just a file label being changed?) the label check and move the file(s). That should give you more flexibility if you want to change things up without having to edit a bunch of stuff in AppleScript.

Let me know, and I'll through together a test script.
 
Hope you had a good holiday weekend!

Yes, Hazel can activate on a label change.

That’s mostly why I screenshot a copy of a rule in my last message. It occurred to me that it might could work that way. The rule I showed would only run when there was no tag and when the AppleScript passed. When both happened, it would tag the file with whatever I chose (red in the case above). But then as soon as that label/tag was in place, the next Hazel rule looking for the (red in the screenshot above) tag/label would pick it up and run with it.

The issue with that is that it’s going to do the same thing as the folder actions, constantly running until the file is expanded, so probably not a better option than folder actions to begin with.

Your launchd recommendation should meet my needs, however, so I‘m good with going that route.

I’ll have to look up how to do that as I’m not familiar, but that’s ok. I need to learn all this in the first place. Put me in a VBA window coding very complex macros from scratch and I’m comfortable. I just need to get out of comfort zone and learn more AppleScript, launchd, shell scripts, etc. I’ve always been easily thrown by differences between programming/scripting languages.
 
Thanks, hope your holiday was good as well.

Ok, I'll post up a script in a little bit.

Here's a good overview on launchd, pretty straightforward. There are also a couple apps that can create/manage tasks (Lingon, LaunchControl)
 
Here's a test script. It will ask for you to select the log file and then to select the upload folder and then it will process the files, pause 30 seconds and then repeat 5 times. I have some alert dialogs displaying for debugging which you can comment out if they get annoying. These and the delay/repeats would be removed in the final script. You can also change the repeat and the delay (in seconds) if needed.

You can also comment out the dialogs asking for the log & directory paths if you set the variables manually in the top section. Use colons instead of slashes in the paths and enclose in parentheses.

As an example if you have a path that is:

/Volumes/Macintosh HD/Users/username/Library/Logs/

you would enter it as:

"Macintosh HD:Users:username:Library:Logs:"

Variables to change:
set theFileDirectory to "Working:Foldername"
set theLogFile to "Path:to:Log:File"

So start some uploads and run the script and lets see how it goes. Let me know.


AppleScript:
--Set Variables for final script
--set theFileDirectory to "Working:Folder"
--set theLogFile to "Path:to:Log:File"
set theLogResult to "Finished Downloading"
set theFilestoProcess to {}

--Testing Quearies -will remove in final script

set theLogFile to choose file with prompt "Please select the Resilio Sync Log File:"

set theFileDirectory to choose folder with prompt "Please select the Folder to Process:"

--Testing Quearies end

--Make a list of all files in the search directory ignoring any files with a red label

tell application "Finder" to set theFilestoProcess to every file in folder theFileDirectory whose label index is not 2

--Loop through the list of files
repeat 5 times
    repeat with i from 1 to length of theFilestoProcess
        set theCurrentListItem to item i of theFilestoProcess as alias
        --set variable for just the filename
        tell application "Finder" to set theFileQuery to the name of file theCurrentListItem
        try
            --Search for the filename in the log file   
            set theLogSearchResult to (do shell script "grep " & the quoted form of theFileQuery & " " & (the quoted form of (the POSIX path of theLogFile)))
            --If filename is found search for 'Finsihsed Downloadiing' in results
            if theLogSearchResult contains theLogResult then
                --if true set the file label to red
                tell application "Finder" to set label index of file theCurrentListItem to 2
                --debugging-will remove
                display alert theFileQuery & " has finished downloading"
                
            else
                --debugging-will remove
                display alert theFileQuery & " has not finished downloading"
            end if
        on error
            --debugging-will remove
            display alert theFileQuery & " was not found in the logfile"
        end try
    end repeat
    delay 30
    
end repeat
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.