Giter Site home page Giter Site logo

robocopyps's People

Contributors

fjollberg avatar maxxattaxx avatar sbergwall avatar wiredsharp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

robocopyps's Issues

Win11: Speed not parsed correctly

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

differential backup

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)

should use $WhatIfPreference rather than $WhatIf

robocopyps\0.2.13\functions\Invoke-RoboCopy.ps1:516 char:49

  •     elseif ($Force -eq $True -and $null -eq $WhatIf) {
    
  •                                             ~~~~~~~
    
  • CategoryInfo : InvalidOperation: (WhatIf:String) [], RuntimeException
  • FullyQualifiedErrorId : VariableIsUndefined

Parser fails to interpret hours more than 24:00:00 on long runs

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.

$TimeLineRegex { [TimeSpan]$TotalDuration, [TimeSpan]$CopyDuration, [TimeSpan]$FailedDuration, [TimeSpan]$ExtraDuration = $PSitem | Select-String -Pattern '\d?\d\:\d{2}\:\d{2}' -AllMatches | ForEach-Object { $PSitem.Matches } | ForEach-Object { $PSitem.Value } }

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.

See e.g.: https://stackoverflow.com/questions/2728321/how-to-parse-string-with-hours-greater-than-24-to-timespan

PS v5: Issue using multiple paths in Get-RoboItem

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

  • Get-RoboItem -Path 'C:\tmp\New folder',"C:\AMD"
  •   + 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

  • Get-RoboItem -Path 'C:\tmp\New folder',"C:\AMD"
  •   + CategoryInfo          : InvalidArgument: (:) [Get-RoboItem], ParameterBindingException
      + FullyQualifiedErrorId : ParameterAlreadyBound,Get-RoboItem
    

Get-RoboItem with -Unit GB on small items gives weird TotalSize

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.

Fix auto loading of module

In Robocopyps.psd1 FunctionsToExport are commented out.
Remove the comment and add FunctionsToExport = '*' or fix auto update the file in the pipeline.

when line cannot be parsed, function may be called on null-valued expression in Invoke-RobocopyParser

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(" ",  ...
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull

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(".")
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull

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 ...
    
  •                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull

Robocopy issue

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

  • Invoke-RoboCopy -Source "C:\Working" -Destination "\backupserver\c$\wor ...
  •   + CategoryInfo          : ObjectNotFound: (Invoke-RoboCopy:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

PS C:\WINDOWS\system32>

[Request] Add option to clear `$global:LastExitCode` on success

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.

Error, Robocopy 0.2.2

Error in Robocopy 0.2.2

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.}	

Remove-RoboItem is not using created temporary folder

$tempDirectory = New-Item -Path $env:temp -Name (New-Guid).Guid -ItemType Directory -ErrorAction Stop

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)

add /v switch

see if its possible to remove /v from forced parameters and add is a -verbose parameter in powershell

create parametersetname

Create parametersetnames - This issue will be split up for each individual parametersetname later on

Remove-RoboItem stops for input if robocopy fails to delete all sub items.

Remove-Item -Path $tempDirectory, $Location -ErrorAction Stop

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.