I'm having weird stuff happen where my local copy of my Google Drive folders seems out of synchronisation (despite G Drive saying it's sync'd). For example, the folder names are different and changing one doesn't affect the other.
This is 2GB worth of files so I don't want to just download them all to do a 'diff'.
Best Answer
The following is a recipe for a comparison based on filenames alone, not based on file modification times or even content checksums. But it's a start :) Also, the below is to compare two directories that are both on Google Drive, but you can easily adapt it by generating a list of your local files instead with some call to
ls
. (So obviously, the below is a recipe for Linux.)1. Install and configure
drive
drive
is a Linux command line client for Google Drive. The easiest is to install it from a package.After that:
Change into the directory on your computer that includes your whole files synced from Google Drive:
Initialize
drive
with access to your Google Drive. This will ask you to visit a URL and paste the auth code you get there, and save this in a config file in the current directory.2. Comparing directories
I found that for large Google Drive folders (36 GiB of small files in my case), starting by comparing directories and fixing cases of missing directories was a good first step. (Also because
drive
has no option to copy directories without the files inside between two Google Drive folders. Not a problem if you compare between local and remote files only.)sort name "dest dir" > DirDiff.2-dest.txt
The
drive
command obtain lists of directories from Google Drive, and thevim
commands remove the differing base directories from each path so that comparison will work properly.Now to list the directories that are only in the source tree:
And to show the directories that are only in the destination tree:
About using
comm
like this, see here.3. Comparing files
This works very similar to comparing directory trees:
To show the files only in the source tree:
To show the files only in the destination tree: