-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
bugThe issue is a bug.The issue is a bug.help wantedThe issue is up for grabs for anyone in the community.The issue is up for grabs for anyone in the community.
Description
These two params are not working properly. If excluding multiple Files or Directories it thinks they are a single file.
if ($ExcludeFiles)
{
$arguments += @('/XF', $ExcludeFiles)
}
if ($ExcludeDirs)
{
$arguments += @('/XD', $ExcludeDirs)
}Exclude Directories is actually missing from the parameters as well, so it is being checked for, but not actually available.
Currently, when robocopy runs, the output looks like this
Exclude Dirs
Files : *.*
Exc Dirs : Files Private
Options : *.* /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /R:1000000 /W:30
Exclude Files
Files : *.*
Exc Files : Invoke-test.ps1xml Test-*
Options : *.* /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /R:1000000 /W:30
The files should be on separate lines line the following output.
Exclude Dirs
Files : *.*
Exc Dirs : Files
Private
Options : *.* /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /R:1000000 /W:30
Exclude Files
Files : *.*
Exc Files : Invoke-test.format.ps1xml
Test-*
Options : *.* /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /R:1000000 /W:30
One way you could handle this is to take ExcludeFolders and ExcludeFiles as arrays, and then add them to the arguments like this.
if ($ExcludeFiles)
{
$arguments += '/XF'
$arguments += $ExcludeFiles
}
if ($ExcludeDirs)
{
$arguments += '/XD'
$arguments += $ExcludeDirs
}Then even if the files or folders have spaces in their names it works without issue.
An Example when passing arrays:
Files : *.*
Exc Files : Invoke-test.format.ps1xml
Test-*
Exc Dirs : Files
Private with spaces
Options : *.* /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /R:1000000 /W:30
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugThe issue is a bug.The issue is a bug.help wantedThe issue is up for grabs for anyone in the community.The issue is up for grabs for anyone in the community.