Skip to content

Commit

Permalink
again fix filepaths remote
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaskueffel committed Nov 7, 2023
1 parent a5d40f3 commit 5f00b1b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions FileSyncLibNet/SyncProviders/SmbLibProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,26 +173,26 @@ public override void SyncSourceToDest()
File.Delete(file);
}
}
foreach (var remoteFile in remoteFiles)
foreach (var remoteFileFromSource in remoteFiles)
{
bool copy = false;
var realFilePath = remoteFile.Trim('\\').Replace('/', '\\');

var realFilePath = remoteFileFromSource.Trim('\\').Replace('/', '\\');
var remoteFileWithSource = Path.Combine(SourcePath, remoteFileFromSource).Trim('\\');
var localFile = Path.Combine(jobOptions.DestinationPath, realFilePath.TrimStart('\\', '/')).Replace('/', '\\');
var exists = File.Exists(localFile);
_ = FileExists(remoteFile, out long remoteSize);
_ = FileExists(remoteFileWithSource, out long remoteSize);
var size = exists ? new FileInfo(localFile).Length : 0;
copy = !exists || size != remoteSize;
if (copy)
{
logger.LogDebug("Copy {A}", realFilePath);
try
{
ReadFile(Path.Combine(SourcePath, remoteFile), localFile);
ReadFile(remoteFileWithSource, localFile);
copied++;
if (jobOptions.DeleteSourceAfterBackup)
{
DeleteFile(remoteFile);
DeleteFile(remoteFileWithSource);
}
}
catch (Exception exc)
Expand Down

0 comments on commit 5f00b1b

Please sign in to comment.