@ -98,24 +98,20 @@ namespace NzbDrone.Common
TransferDirectory ( subDir . FullName , Path . Combine ( target , subDir . Name ) , transferAction ) ;
TransferDirectory ( subDir . FullName , Path . Combine ( target , subDir . Name ) , transferAction ) ;
}
}
foreach ( var f ile in sourceFolder . GetFiles ( "*.*" , SearchOption . TopDirectoryOnly ) )
foreach ( var sourceF ile in sourceFolder . GetFiles ( "*.*" , SearchOption . TopDirectoryOnly ) )
{
{
var destFile = Path . Combine ( target , f ile. Name ) ;
var destFile = Path . Combine ( target , sourceF ile. Name ) ;
switch ( transferAction )
switch ( transferAction )
{
{
case TransferAction . Copy :
case TransferAction . Copy :
{
{
f ile. CopyTo ( destFile , true ) ;
sourceF ile. CopyTo ( destFile , true ) ;
break ;
break ;
}
}
case TransferAction . Move :
case TransferAction . Move :
{
{
if ( FileExists ( destFile ) )
MoveFile ( sourceFile . FullName , destFile ) ;
{
File . Delete ( destFile ) ;
}
file . MoveTo ( destFile ) ;
break ;
break ;
}
}
}
}
@ -130,6 +126,11 @@ namespace NzbDrone.Common
public virtual void MoveFile ( string sourcePath , string destinationPath )
public virtual void MoveFile ( string sourcePath , string destinationPath )
{
{
if ( FileExists ( destinationPath ) )
{
DeleteFile ( destinationPath ) ;
}
File . Move ( sourcePath , destinationPath ) ;
File . Move ( sourcePath , destinationPath ) ;
}
}