sbergwall / robocopyps Goto Github PK
View Code? Open in Web Editor NEWRobocopyPS
License: MIT License
RobocopyPS
License: MIT License
When using special characters, like [, the Source parameter wont work.
When using Windows 10 the output in native Robocopy.exe is:
Speed : 238518759 Bytes/sec.
Windows 11:
Speed : 4 621 986 578 Bytes/sec.
Windows 11 seems to introduce spaces and this is not handled in Invoke-RobocopyParser.ps1
If possible could u add the possibility to make differential backup possible.
example:
i copy 1 folder full(main)
then every new changes go to a new separate folder/zip file instead of writing over everything(something similar to cobian software)
robocopyps\0.2.13\functions\Invoke-RoboCopy.ps1:516 char:49
elseif ($Force -eq $True -and $null -eq $WhatIf) {
~~~~~~~
This seem to fail for really long running jobs (days). Not 100% certain this is the crash I see, but believe it is.
MetadataError: Cannot convert value "68:49:05" to type "System.TimeSpan". Error: "The TimeSpan string '68:49:05' could not be parsed because at least one of the numeric components is out of range or contains too many digits.
Eg: > [TImespan]$d = "68:49:05"
MetadataError: Cannot convert value "68:49:05" to type "System.TimeSpan". Error: "The TimeSpan string '68:49:05' could not be parsed because at least one of the numeric components is out of range or contains too many digits."
I guess it's hours:minutes:seconds, but the Timespan parser want to interpret it some other way by default.
Using multiple paths in Get-RoboItem results in error. This error only occur in PS 5 but works in PS 7.
Get-RoboItem -Path 'C:\tmp\New folder',"C:\AMD"
Get-RoboItem : Cannot bind parameter because parameter 'Path' is specified more than once. To provide multiple values
to parameters that can accept multiple values, use the array syntax. For example, "-parameter value1,value2,value3".
At line:1 char:1
+ CategoryInfo : InvalidArgument: (:) [Get-RoboItem], ParameterBindingException
+ FullyQualifiedErrorId : ParameterAlreadyBound,Get-RoboItem
Get-RoboItem : Cannot bind parameter because parameter 'Path' is specified more than once. To provide multiple values
to parameters that can accept multiple values, use the array syntax. For example, "-parameter value1,value2,value3".
At line:1 char:1
+ CategoryInfo : InvalidArgument: (:) [Get-RoboItem], ParameterBindingException
+ FullyQualifiedErrorId : ParameterAlreadyBound,Get-RoboItem
Get-RoboItem with -Unit GB on small items gives weird TotalSize where an expected '0' is missing.
The property Speed is also mangled.
This is not a major issue to me as I switched over to the new TotalSizeBytes for my purposes.
Get-RoboItem \Some\path -Recurse -Threads 16 -Unit GB
Source : \Some\path
Destination : NULL
Command : Robocopy.exe "\Some\path" "NULL" . /r:3 /w:3 /e /MT:16 /l /bytes /TEE /np /njh /fp /ndl /ts
...
TotalSize : GB
TotalSizeCopied : GB
TotalSizeIgnored : GB
TotalSizeMismatched : GB
TotalSizeFailed : GB
TotalSizeExtra : GB
TotalSizeBytes : 50793
Speed : GB/s
ExitCode : 1
Success : True
LastExitCodeMessage : [SUCCESS]All files were copied successfully.
In Robocopyps.psd1 FunctionsToExport are commented out.
Remove the comment and add FunctionsToExport = '*' or fix auto update the file in the pipeline.
Hey there,
I noticed this module is incompatible with PowerShell 7.3+.
After some testing I determined it's due to the change to native program argument parsing.
It seems that this module can be trivially fixed by adding $PSNativeCommandArgumentPassing="legacy"
into the Invoke-Robocopy.ps1
script before robocopy.exe
is called.
with robocopy v10.0.14393 .5582, output parsing fails with the following:
You cannot call a method on a null-valued expression.
At RobocopyPS\0.2.13\internal\Invoke-RobocopyParser.ps1:84 char:13
$Size, [datetime]$TimeStamp = $line[2].Trim().Split(" ", ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You cannot call a method on a null-valued expression.
At RobocopyPS\0.2.13\internal\Invoke-RobocopyParser.ps1:85 char:13
$ExtensionSplit = ($Line[3]).Split(".")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You cannot call a method on a null-valued expression.
At RobocopyPS\0.2.13\internal\Invoke-RobocopyParser.ps1:88 char:33
Extension = if ($ExtensionSplit.count -gt 1) { $Exten ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~
I can get it installed but it doesn't seem to be working when I run it. Entire string is below from install to run.
PS C:\WINDOWS\system32> install-module -Name robocopyps
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its
InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from
'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y
PS C:\WINDOWS\system32> Invoke-RoboCopy -Source "C:\Working" -Destination "\backupserver\c$\working" -List -Recurse -Verbose -BackupMode
Invoke-RoboCopy : The term 'Invoke-RoboCopy' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:1
+ CategoryInfo : ObjectNotFound: (Invoke-RoboCopy:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\WINDOWS\system32>
Hey, I was just wondering if you think it might be a good idea to add a parameter -ClearLastExitCodeOnSuccess
that would reset the $global:LastExitCode
back to zero when the Robocopy operation "succeeded".
The logic is already implemented in the parser to set the Success
property of the returned object, so it wouldn't be a difficult thing to check at the end of the Invoke-Robocopy operation.
I'll start working on a basic implementation of it, you can review the PR and decide whether it's a good idea or not.
InvalidOperation: C:\Users\Alex\Documents\PowerShell\Modules\RobocopyPS\0.2.2\internal\Invoke-RobocopyParser.ps1:73
Line |
73 | $Size, [datetime]$TimeStamp = $line[2].Trim().Split(" ", …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.
InvalidOperation: C:\Users\Alex\Documents\PowerShell\Modules\RobocopyPS\0.2.2\internal\Invoke-RobocopyParser.ps1:74
Line |
74 | $ExtensionSplit = ($Line[3]).Split(".")
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.
InvalidOperation: C:\Users\Alex\Documents\PowerShell\Modules\RobocopyPS\0.2.2\internal\Invoke-RobocopyParser.ps1:77
Line |
77 | … sion = if ($ExtensionSplit.count -gt 1) { $ExtensionSplit[-1] } else …
| ~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.
...
| You cannot call a method on a null-valued expression.
[2020-04-30 07:41:38+03] [ERROR ] @{Source=c:\ProgramData\Medoc\Medoc; Destination=\\192.168.0.61\Backup\!ArchiveRepo\.
RootMirrors\medoc.data\Medoc; Command=Robocopy.exe "c:\ProgramData\Medoc\Medoc" "\\192.168.0.61\Backup\!ArchiveRepo\.Roo
tMirrors\medoc.data\Medoc" *.* /r:3 /w:3 /mir /bytes /TEE /np /njh /fp /v /ndl /ts; DirCount=0; FileCount=0; DirCopied=0
; FileCopied=0; DirIgnored=0; FileIgnored=0; DirMismatched=0; FileMismatched=0; DirFailed=0; FileFailed=0; DirExtra=0; F
ileExtra=0; TotalTime=00:00:10; StartedTime=04/30/2020 07:41:27; EndedTime=04/30/2020 07:41:38; TotalSize=0 B; TotalSize
Copied=0 B; TotalSizeIgnored=0 B; TotalSizeMismatched=0 B; TotalSizeFailed=0 B; TotalSizeExtra=0 B; Speed=0 B/s; ExitCod
e=9; Success=False; LastExitCodeMessage=[ERROR]Some files did copy, but copy errors occurred and the retry limit was exc
eeded. Check these errors further.}
There is a bug here I believe, robocopy should mirror from created $tempDirectory to $Location. As the code is written currently it mirrors from $Location to $Location wich fails.
I believe $PSBoundParameters.Set_Item("Path", $location)
should rather be:
$PSBoundParameters.Set_Item("Path", $tempDirectory)
see if its possible to remove /v from forced parameters and add is a -verbose parameter in powershell
Create parametersetnames - This issue will be split up for each individual parametersetname later on
If Robocopy for some reason fails to remove all subitems Remove-RoboItem stops executing and waits for input with the following output:
Confirm
The item at Microsoft.PowerShell.Core\FileSystem::\some\path has children and the Recurse parameter was not specified. If you continue, all children will be removed with the item. Are you sure you want to continue?
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"):
Behaviour can be simulated with:
> New-Item test\test -ItemType Directory
> Remove-Item -Path test -ErrorAction Stop
Not sure what the behaviour should be here. I think arguably the best way would be to test if the path is really empty before trying to remove it, so the script doesn't stop for input at this point.
Another way would be a -Recurse, but that has potentially odd effects if there are a lot of data left by Robocopy and sort of interferes with the behaviour of robocopy.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.