Closed tukanos closed 8 months ago
I don't think this is an issue with FastCopy, but rather an issue with how you use PowerShell.
How about looking at the differences in the
I don't think this is an issue with FastCopy, but rather an issue with how you use PowerShell. How about looking at the differences in the lines in fastcopy.log when running with cmd.exe and PowerShell.exe?
I dug deeper into this issue as it seems weird there is some kind of interaction between FastCopy and PowerShell that does not work correctly (it is hard to say where actually the bug is, without debugging it with debugger). I have even found what is causing the issue when using FastCopy and PowerShell splatting
I did, of course, look at the fastcopy.log and the difference was that that CMD copied everything correctly and the above powershell script did not copy anything.
I tried every single supported way how to execute an executable in the powershell. I found a way in which it works.
For future reference using hashtable
and start-process
:
$processOptions = @{
FilePath = 'C:\app\FastCopy\fcp.exe'
ArgumentList = '/cmd=noexist_only','/include="*.7z*"','/no_ui','/no_confirm_stop','/verify'
RedirectStandardOutput = "FastCopyStdOutput.txt"
RedirectStandardError = "FastCopyError.txt"
UseNewEnvironment = $true
}
$processOptions.'ArgumentList' += '/logfile=X:\Pohoda_MSSQL_zalohy\test\FastCopy.log'
$processOptions.'ArgumentList' += 'C:\t\PohodaSQL\Data','/to=X:\Pohoda_MSSQL_zalohy\test'
Start-Process @processOptions
However, the splatting is broken with FastCopy and the culprit seems to be the filtering /include="*.7z*"
. So even when I use stop parsing input as powershell command or expression for FastCopy it does not work:
& C:\app\FastCopy\fcp.exe --% /cmd=noexist_only /include="*.7z*" /no_ui /no_confirm_stop /verify /logfile=X:\Pohoda_MSSQL_zalohy\test\FastCopy_splat.log C:\t\PohodaSQL\Data /to=X:\Pohoda_MSSQL_zalohy\test
That should work, but hard to say if that is FastCopy's or PowerShell's fault, but it is certainly something to be aware of.
Describe the bug An executed command in cmd.exe works correctly, but the equivalent command does not work correctly in PowerShell 7.4.0.
To Reproduce I wanted FastCopy to copy only .7z and .7z.sha256 files so I did the following:
c:\app\FastCopy\fcp.exe /cmd=noexist_only /include="*.7z*" /no_ui /no_confirm_stop /verify /logfile=X:\Pohoda_MSSQL_zalohy\internal_db\FastCopy_internalDBBackup_Pohoda_2024-03-22.log C:\Stormware\PohodaSQL\Data /to=X:\Pohoda_MSSQL_zalohy\internal_db
Here the files are correctly copied to the destination.