Batch file for running GYB backup with log

180 views
Skip to first unread message

Christian

unread,
Oct 26, 2014, 8:58:29 AM10/26/14
to got-yo...@googlegroups.com
Hi all,

I just started using GYB yesterday and wanted to have it run as a scheduled task in windows.
After searching various sites I was able to put below batch file together.

for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j
set ldt=%ldt:~0,4%-%ldt:~4,2%-%ldt:~6,2% %ldt:~8,2%:%ldt:~10,2%:%ldt:~12,6%

echo GYB started on
: [%ldt%] > gyb_backup_log.txt
gyb
.exe --email yourmail@gmail.com --action backup >> gyb_backup_log.txt

for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j
set ldt=%ldt:~0,4%-%ldt:~4,2%-%ldt:~6,2% %ldt:~8,2%:%ldt:~10,2%:%ldt:~12,6%

echo GYB ended on
: [%ldt%] >> gyb_backup_log.txt


First part is just producing a time stamp when the job starts. I found the code here http://stackoverflow.com/questions/203090/how-to-get-current-datetime-on-windows-command-line-in-a-suitable-format-for-us
Output of log is done to gyb_backup_log.txt
The gyb results are added to the file using >>
Finally the end time is added to the file.

The logfile gyb_backup_log.txt I get looks like this
GYB started on: [2014-10-26 13:42:41.450]

Using backup folder GYB-GMail-Backup-yourname@gmail.com
Using folder [Gmail]/All Mail
GYB needs to examine
53014 messages
GYB already has a backup of
53011 messages
GYB needs to backup
3 messages

backed up
3 of 3 messages

GYB needs to refresh
53011 messages

refreshed
10000 of 53011 messagesrefreshed 20000 of 53011 messagesrefreshed 30000 of 53011 messagesrefreshed 40000 of 53011 messagesrefreshed 50000 of 53011 messagesrefreshed 53011 of 53011 messages

GYB ended on
: [2014-10-26 13:45:10.625]

I just post this as inspiration in case someone finds this useful.
Reply all
Reply to author
Forward
0 new messages