I'm trying to see if a solution with Robocopy could be faster than using the Get-ChildItem
for getting a list of files that are inside a given folder (and subfolders...).
In my code I'm using the Get-ChildItem
cmdlet to get a list of all files inside a specific folder in order to loop on each of these file:
$files = Get-ChildItem "C:\aaa" -Recurse | where {! $_.PIsContainer} # ! because I don't want to list folders
foreach ($file in $files){
...
}
Now, I have the robocopy command to get a list of all files, however, the output of robocopy is a string.
[string]$result = robocopy "C:\aaa" NULL /l /s /ndl /xx /nc /ns /njh /njs /fp
So, how can I use the output from the robocopy command to loop on each file (similar to what was done with Get-ChildItem
?