![]() $folder2=Get-ChildItem C:\temp2 -recurse -FileĬompare-Object $folder1 $folder2 -Property Fullname -PassThru |īy doing a little research on how a PS CmdLet works you can find that there are any number of useful variations. $folder1=Get-ChildItem C:\temp -recurse -File ![]() Here is an example of customizing a result: It is a simple technique to learn but does require a certain amount of concentrated effort. Looping and using file content to drive a loop s fundamental to all programming and to PowerShell. You can use this to create any kind of output you need. Other things to consider are that you can extract the complete file object from the results. Write-Host "$fileSuffix is only in $folder2" $fileSuffix = $_.FullName.TrimStart($folder1) # Check if the file, from $folder2, exists with the same path under $folder1 Write-Progress -Activity "Searching for files only on second folder" -status "Searching File $i of $totalCount" -percentComplete ($i / $secondFolder.Count * 100) $firstFolder = Get-ChildItem -Recurse $folder1 | Where-Object # Get all files under $folder1, filter out directories Why do I get the 2 / when there is a difference in the folder2? If there are differences, showing an error of "everything is the same in both folders"ģ. I have this script to compare folders, but would need:Ģ.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |