PostSyncCommand

Discuss new features and functions
Posts: 5
Joined: 22 Dec 2017

oriceon

Hello there.

Is there a way to run a command only if changes occurred after synchronization in target directory?

I want to taskkill a process and reopened it.


Thanks.
User avatar
Posts: 2291
Joined: 22 Aug 2012

Plerry

You can define a command-line instruction in the "On Completion" line in the Sync Settings (F8) for invoking a user script that might then analyze the FFS log-file, and acts according to what it finds in the log file.
Posts: 5
Joined: 22 Dec 2017

oriceon

It was nice if already has an implementation of that. Sure, i'll made a bat to read Last log and see if found synced files and do necessary.. Thank you for your time.
Posts: 5
Joined: 22 Dec 2017

oriceon

Maybe someone need a bat to do that.
@echo off

setlocal enableextensions disabledelayedexpansion

set logPath=Path_To\Logs

set "lastLog="
for /f "delims=" %%a in ('dir /b /o-d "%logPath%\BatchRun*.log" 2^>nul') do (
  if not defined lastLog set "lastLog=%%a"
)


if /i "%lastLog%" NEQ "Access" (

    findstr -sip /c:"Nothing to synchronize" "%logPath%\%lastLog%"
    IF NOT ERRORLEVEL 1 (
        echo Nothing to synchronize
    ) else (
        echo Files synchronized


        taskkill.exe /f /im app.exe
        start "" "Your App Path.exe"
    )
)

exit /b