Compare relative file inventories of two folders
Build a paste-ready command, then review its compatibility and effects before running it.
Compare-Object (Get-ChildItem <source> -File -Recurse | ForEach-Object FullName) (Get-ChildItem <destination> -File -Recurse | ForEach-Object FullName)Complete required fields to copy the generated command.
read-onlyno known side effects Compatibility
WindowsVerified for Windows using powershell syntax.
Operational knowledgereview due 2027-01-19
RequirementsCompare-ObjectCompare-Object must be installed and available on PATH.
Version supportCompare-Object Current supported releasesVerified for windows using powershell syntax; consult compatibility notes for platform-specific differences.
Expected signalsInputObject SideIndicatorRepresentative successful output; values vary with the selected target and system state.
Known errorsCompare-Object: command not foundCompare-Object is missing or is not available on PATH.
VerifyCompare-Object (Get-ChildItem {{source}} -File -Recurse | ForEach-Object FullName) (Get-ChildItem {{destination}} -File -Recurse | ForEach-Object FullName)The output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01Compare-ObjectCommandRuns the Compare-Object stage of this one-liner.
02(Get-ChildItemArgumentPasses (Get-ChildItem to Compare-Object.
03<source>ParameterA value supplied in the Fill parameters section.
04-FileOptionConfigures Compare-Object with the -File option.
05-RecurseOptionConfigures Compare-Object with the -Recurse option.
06|PipelinePasses the output on the left to the command on the right.
07ForEach-ObjectCommandRuns the ForEach-Object stage of this one-liner.
08FullName)ArgumentPasses FullName) to ForEach-Object.
09(Get-ChildItemArgumentPasses (Get-ChildItem to ForEach-Object.
10<destination>ParameterA value supplied in the Fill parameters section.
11-FileOptionConfigures ForEach-Object with the -File option.
12-RecurseOptionConfigures ForEach-Object with the -Recurse option.
13|PipelinePasses the output on the left to the command on the right.
14ForEach-ObjectCommandRuns the ForEach-Object stage of this one-liner.
15FullName)ArgumentPasses FullName) to ForEach-Object.
This advanced community-curated one-liner combines several stages. Review every option and placeholder before running it.
Example input
Compare-Object (Get-ChildItem C:\release-a -File -Recurse | ForEach-Object FullName) (Get-ChildItem C:\release-b -File -Recurse | ForEach-Object FullName)
Example output
InputObject SideIndicator
----------- -------------
C:\release-b\manifest.json =>
C:\release-a\legacy.config <=
Illustrative output — exact values vary by system and data.
Official sources