Run batch file only if there was a file synced

Welcome to BestSync Support Forum!
If you have any questions, comments, concerns, suggestion, please summit here, we'll try to reply you in short time.
Thank you!
Post Reply
TheFonz
Posts: 2
Joined: Mon Nov 11, 2013 9:48 am

Run batch file only if there was a file synced

Post by TheFonz »

I am using BestSync 2014 and am loving it so far, just wondering if it's possible to have BestSync run a batch file ONLY if a file has needed to be synced. If no file was synced I do not want the batch file to run. If this is not entirely possible I would rather the batch file not process the steps if there was nothing synced.
I would love to see a check box similar to the batch file to run before synchronization that states: "Run the application only when there are files need to be synchronized after scanning"
Any ideas?
TheFonz
Posts: 2
Joined: Mon Nov 11, 2013 9:48 am

Re: Run batch file only if there was a file synced

Post by TheFonz »

I came up with my own solution, feel free to use it:
This will only report if there are files, including files inside sub-folders - it will not count empty folders as a file and will return a result of empty

@echo off

goto :main

REM *** === Function "Test" ===================================================

:test
if not "%1" == "" (
if exist "%1" (
( dir /s /b /a-d "%1" | findstr "^" ) > nul && (
echo %1 not empty
) || (
echo %1 empty
)
) else (
echo %1 missing
)
) else (
echo error: no parameter
)
goto :EOF

REM *** === Main ==============================================================

:main

call :test "DownloadDirectoryHere"
Post Reply