Live Mesh is a great piece of software. But you may or may not be aware that it doesn’t synchronize all files. There’s various reasons why it might exclude a particular file, which are detailed here.
If you’re like me and spend a lot of time evaluating beta software and operating systems, juggle multiple machines, etc. you may be tempted to blow away your hard drive’s contents assuming that Live Mesh has you covered. In most cases you’ll be fine but for a sanity check, here’s a PowerShell script that will show you which files in a particular folder will not be synchronized due to Mesh’s exclusion criteria.
Note: This script requires PowerShell 2.0 CTP 3 as all of my scripts do.
Note: This will only tell you which files meet the exclusion criteria and does not guarantee that files not reported are actually synchronized.
##############################################################################
#.SYNOPSIS
# Lists the files in a directory that are excluded from live mesh synchronization.
#
#.PARAMETER Path
# Specifies the path to an item. Wildcards are permitted.
#
#.PARAMETER LiteralPath
# Specifies the path to an item. Unlike Path, the value of LiteralPath is
# used exactly as it is typed. No characters are interpreted as wildcards.
# If the path includes escape characters, enclose it in single quotation marks.
# Single quotation marks tell Windows PowerShell not to interpret any
# characters as escape sequences.
#
#.PARAMETER ShowProgress
# If specified, a progress indicator will show the files being processed.
#
#.EXAMPLE
# Get-MeshExclusions C:\Personal
##############################################################################
function Get-MeshExclusions {
[CmdletBinding(DefaultParameterSetName='Path')]
param(
[Parameter(ParameterSetName='Path', Position=1, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)]
[String[]]$Path='.',
[Alias("PSPath")]
[Parameter(ParameterSetName='LiteralPath', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[String[]]$LiteralPath,
[Parameter()]
[Switch]$ShowProgress
)
begin {
$ExcludedExtensions = @('.bak','.gfs','.laccdb','.lnk','.mbf','.mny','.mpc','.pst','.sav','.tmp','.wlx')
$ExcludedNames = @('desktop.ini','thumbs.db')
$ExcludedFolders = @([Environment]::GetFolderPath('DesktopDirectory'))
}
process {
switch ($PSCmdlet.ParameterSetName) {
Path { $ResolveArgs = @{Path=$Path} }
LiteralPath { $ResolveArgs = @{LiteralPath=$LiteralPath} }
}
if ($ShowProgress) { $PathResolver = { Resolve-Path @ResolveArgs | Progress-Object } }
else { $PathResolver = { Resolve-Path @ResolveArgs } }
&$PathResolver | %{
Write-Verbose "$($PSCmdlet.MyInvocation.MyCommand.Name) Processing $_"
#################
# PUT CODE HERE #
#################
Get-ChildItem -Path $_ -Recurse -Force | %{
$Exclusion = 'Included'
if ($ExcludedExtensions -contains $_.Extension) {
$Exclusion = 'Blocked Extension'
}
elseif ($ExcludedNames -contains $_.Name) {
$Exclusion = 'Special File'
}
elseif ($_.Name -like '~*') {
$Exclusion = 'Tilde'
}
elseif ($ExcludedFolders -contains $_.DirectoryName) {
$Exclusion = 'Blocked Directory'
}
elseif ($_.Attributes -band [IO.FileAttributes]::Hidden) {
$Exclusion = 'Hidden File'
}
elseif ($_.Attributes -band [IO.FileAttributes]::System) {
$Exclusion = 'System File'
}
if ($Exclusion -ne 'Included') {
$_ | Add-Member NoteProperty Exclusion $Exclusion -PassThru
}
} | Select Name,DirectoryName,Length,Exclusion
}
}
}