The Windows Client uses a dynamic synchronization technology that maintains surrogate files for folder listings until a user (or program) accesses the file(s). Once a file has been accessed, the file's contents will be downloaded from the cloud to the Windows Client's cache directory.
This helps with performance, since you will only download the files that you actually need to view or edit. Furthermore, as an added safety feature, the Windows Client automatically skips potentially problematic files that begin with a leading period in the name, windows thumbnail cache files (thumbs.db), Mac OSX index files (.DS_Store), and certain Temporary files (.tmp).
One potential problem with the dynamic sync technology is that you may want to know what files have been skipped, but some popular folder synchronization programs, such as Microsoft SyncToy (freeware), cannot access the Windows Client mounted drive if you want to run a direct comparison between the contents of the mounted drive and the original source folder.
One possible workaround is to create a report using a PowerShell script to generate two command prompt lists (one on the windows client mounted drive and another on the attached folder source), and then use C# to compare files and display the output on the screen. This comparison will be strictly based on file names, since the files are not actually present on the mounted drive. The command prompt DIR command used in the script has the following parameters:
/S: Displays files recursively, traversing any subdirectories./B: Uses bare format (no heading information or summary)./A-D: Exclude directories
Below is the PowerShell script that you can either save as a ps1 file, or cut-and-paste into a PowerShell window and execute directly. If the mounted drive and the attached source folders are on different machines, you could generate the file listings separately, then modify the script to skip the generation of the file lists and simply look for the text files from a hard-coded location. To generate a file listing and output it to a text file, run the following command from a command prompt window:
DIR /S /B /A-D "[FULL PATH TO ATTACHED SOURCE OR MOUNTED DRIVE]" > "C:\temp\[ANY FILE NAME].txt"
Full PowerShell Script
Make sure to edit the declarations of the $FOLDER_A and $FOLDER_B variables to suit your needs.
#This PowerShell script can be used to compare the contents of a Dynamically-Synced Mounted Cloud Drive Folder
#against an original source folder
#For example: if you copy-and-paste a large folder from your hard drive into the Windows Client root,
#you can run this script (after all the files have been synced) to get a list of files that have been skipped or
#ignored by the Windows Client
#This script basically writes two files to the %LOCALAPPDATA% folder's TEMP folder
#The files will contain a basic list of all the files in a folder A and a folder B
#At the end of the script, we run a simple C# comparison script to determine what lines are missing from folder list B
#The output will be displayed on the screen, as well as written to a file named FolderDifferences.txt
#========================================================================================================
#EDIT $FOLDER_A and $FOLDER_B VARIABLES BETWEEN THE EQUAL SIGN LINES ONLY
#$FOLDER_A should be the full path of the source folder
$FOLDER_A = "C:\Test Files for Uploads\TestSimple - Edited"
#$FOLDER_B should be the full path of the destination folder on the windows client drive
$FOLDER_B = "M:\TestSimple - Edited"
#========================================================================================================
$LOCALFOLDER = "$env:LOCALAPPDATA\TEMP"
#The following 6 lines generate a list of all files in the source and destination folders. The output is saved to files in the TEMP directory
$COMMANDA = "DIR /S /B /A-D ""$FOLDER_A"" > ""$LOCALFOLDER\FolderAList.txt"""
$COMMANDB = "DIR /S /B /A-D ""$FOLDER_B"" > ""$LOCALFOLDER\FolderBList.txt"""
#We need to change the output to Unicode to make sure the list of files don't contain replacement characters for foreign languages
CMD /C "Chcp 65001"
CMD /C $COMMANDA
CMD /C $COMMANDB
#The following 2 lines replace the source root and destination root paths, so both files are mostly identical
(Get-Content "$LOCALFOLDER\FolderAList.txt").replace("$FOLDER_A", "") | Set-Content "$LOCALFOLDER\FolderAList.txt"
(Get-Content "$LOCALFOLDER\FolderBList.txt").replace("$FOLDER_B", "") | Set-Content "$LOCALFOLDER\FolderBList.txt"
#The following is the C# code that performs the comparison
$Source = @"
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
public class VFileComparer
{
public static void Run()
{
string tempdir = Environment.GetEnvironmentVariable("LocalAppData") + "\\Temp\\";
String[] linesA = File.ReadAllLines(Path.Combine(tempdir, "FolderAList.txt"));
String[] linesB = File.ReadAllLines(Path.Combine(tempdir, "FolderBList.txt"));
IEnumerable<String> onlyDiffs = linesA.Except(linesB);
File.WriteAllLines(Path.Combine(tempdir, "FolderDifferences.txt"), onlyDiffs);
}
}
"@
#This line simply clears the Powershell window
CMD /C "CLS"
#The following 5 lines execute the C# script
if (-not ([System.Management.Automation.PSTypeName]'VFileComparer').Type)
{
#add the VFileComparer class to memory if it has not been added in this session already
Add-Type -TypeDefinition $Source -Language CSharp
}
[VFileComparer]::Run()
#Finally, we display the contents of the differences on the Powershell window
(Get-Content "$LOCALFOLDER\FolderDifferences.txt")
A list of files from the attached folder that are missing on the Cloud Drive will be displayed directly on the PowerShell window.
Comments
0 comments
Article is closed for comments.