2
Good afternoon, I’m using the following script on powershell to copy files from one folder to another:
Function CopyFiles
{
Param ($folderSource, $folderDestiny)
$allFilesSource = Get-ChildItem -Path $folderSource
$allFilesDestiny = Get-ChildItem -Path $folderDestiny
for ($i = 0; $i -lt $allFilesSource.Count; $i++)
{
$curFileName = $allFilesSource[$i].Name
$fileExist = "$folderDestiny\$curFileName"
for ($j = 0; $j -lt $allFilesDestiny.Count; $j++)
{
if (-not(Test-Path -path $fileExist))
{
Copy-Item $allFilesSource[$i].FullName $folderDestiny
}
}
}
}
CopyFiles 'c:\PastaOrigem' 'D:\PastaDestino'
The problem is that in the folder Grassland there are files with the character "[" and these files script
don’t copy, someone can help me?
Thank you very much, it worked
– Maykon Luiz Matos Araujo