0

I need to run a cron with rsync. I wrote a batch script, That is my script:

START C:\cygwin64\bin\rsync.exe -v -rlt -z -p --update --delete  --progress --log-file=/home/Administrator/rsynclogs/Invoices.log  "/cygdrive/y/folderA//" "/cygdrive/e/folderB//"

When I run the script from command prompt, a new command prompt gets open and the script get's executed correctly. When I run it from task scheduler I get this error:

2019/03/11 10:40:07 [6000] building file list
2019/03/11 10:40:07 [6000] rsync: change_dir "/cygdrive/y/folderA/" failed: No such file or directory (2)
2019/03/11 10:40:07 [6000] sent 20 bytes  received 12 bytes  64.00 bytes/sec
2019/03/11 10:40:07 [6000] total size is 0  speedup is 0.00
2019/03/11 10:40:07 [6000] rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]

What can be the problem? Please don't tell me to install cron with cygwin, at this point I want to try and fix it without it.

0

I think you need to use rsync together with bash in order to have access to /path/to/somewhere type of files. In CMD, you can only use paths like C:\to\somewhere etc.

So to solve the problem, you can try this in your script:

start C:\cygwin64\bin\bash.exe -c '/bin/rsync.exe ...'  

A simple test:

enter image description here

  • The commend doesn't pass trough. Tried from cmd as well. – matisa Mar 11 at 10:33
  • @matisa It should work. Please check screenshot I added to answer. – David Dai Mar 12 at 1:59
  • Ok, not work in bash - still the same error. In bout cases I get the error only when I run it from task scheduler. – matisa Mar 14 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.