All Things WinBatch > WinBatch

Copy From Google Drive Fails

(1/2) > >>

Quicken discourages users from storing their data file on Google Drive. They prefer to run it locally then back it up to Google Drive (which in our case is mirrored in both locations) when you exit. OK, we can do that. Add to the mix that we have PC1 at office and PC2 at home. User wants to, and should be able to, run Quicken at either location (only one at a time) and use Google Drive's replication to not have to manually update the files each time he switches locations.

So the script below aims to automate this process. His name was changed in it. Script checks 2 files in diff folders to see which is newer. It copies the Google Drive file if that one is newer; otherwise it starts Quicken using the local file. Once the user exits from Quicken, it copies the local data file to My Drive, and shows the user the timestamp of the data file. From there Google Drive replicates to the My Drive cloud, and is synced with the PC at the other location. Easy Peasy, right?

My problem is that the script errors out on the first FileCopy line with a 1009 WinBatch error reading the source file. But if I change the script and copy that same file from a different, non-MyDrive folder, it works. And if I manually copy that file it works. It's almost like there's something preventing the WinBatch FileCopy command from working with My Drive.

================ WINBATCH SCRIPT BEGIN

; File comparison between production Quicken data file location and backup location.
; If local file is not the most current it copies from My Drive to ensure we always open
; the most current file in the local folder no matter which computer (home or office) we run it from.

File1=FileTimeCode("C:\users\mike\documents\quicken\mike's quicken data.qdf")
File2=FileTimeCode("C:\users\mike\my drive\mike parker\quicken backups\Mike's Quicken Data.qdf")

If File1==File2
   Stamp="File comparison shows that the Quicken files have the same timestamp. Will start Quicken with the local file."
   GoTo Run
   If File1 > File2
      Stamp="File comparison shows that the local file is newer. Will start Quicken with that file."
      GoTo Run
      Stamp="File comparison shows that the MyDrive file is newer. Will copy it to the local Quicken folder, then start Quicken with that file."
      FileCopy(File2, File1, @False)

;Message("", stamp)
DirChange("C:\Program Files (x86)\Quicken\")

MyDrive=("C:\users\mike\my drive\mike parker\quicken backups\")
FileCopy("mike's quicken data.qdf", MyDrive, @False)
File3=FileTimeGet("C:\users\mike\my drive\mike parker\quicken backups\Mike's Quicken Data.qdf")
Message("The timestamp of the backup Quicken file on MyDrive is", File3)

================ WINBATCH SCRIPT END

Any ideas?

Keep in mind that I don't use Google Drive because of annoying unhandled driver exceptions. Not sure if this is more of an MSFT problem or a Google problem but given recent history I suspect MSFT.

The best approach to this or any computer problem is to use a few problem-solving skills.

In this case, the first thing to check for is a UAC problem with your script. Assuming you are logged on to a PC with an admin account try renaming your script with the file extension ".wbt_if" instead of ".wbt". If your script works after the rename, you have a UAC problem.

I used a poor choice of words. It's not a script, it has been compiled and is an exe.

Then what are your compiled script's UAC  settings?

<edit> It is much easier to find script problems by running the uncompiled script and only compiling once the problem is solved.

Installed Google Drive on Windows 11 virtual machine and had no issues copying files to and from a Google Drive mapped into the file system. Now I just need to remove it from the VM.


[0] Message Index

[#] Next page

Go to full version