E
E
eugene1592020-08-29 06:39:09
System administration
eugene159, 2020-08-29 06:39:09

How to recursively compare 2 folders in Windows and get information, including those files and folders that are not accessible?

Experimented with the robocopy utility.

I have created a closed_folder_parent folder. I put 3 pictures in there. And a closed_folder folder with 3 text documents. In Properties -> Security for closed_folder, I set "Deny" everywhere (for all users). And in closed_folder I put the folder some_folder with the text document some_txt.txt.
Here is the structure.

closed_folder_parent
-- closed_folder
    -- some_folder
        -- some_txt.txt
    -- robocopy.txt
    -- robocopy_programming_v.txt
    -- sort.txt
-- ошибка powershell.png
-- ПРЯМОУГОЛЬНИК.png
-- Сбой.png

I ran the command:
robocopy D:\closed_folder_parent D:\test /e /V /TS /FP /ETA /TEE /r:1 /w:1 /LOG:D:\robocopy.txt /MIR

Here is the part of the result that you need to pay attention to.
ВсегоСкопировано ПропущеноНесоответствие      СБОЙДополнения
Каталогов :         3         1         1         0         1         0
  Файлов :         3         3         0         0         0         0

The utility considers that there are 3 files in total. And all of them are copied. But there are actually 7 files.

Are there any ways to recursively compare 2 folders and get information, including about those files and folders that are not accessible?

I tried the windiff.zip program - it didn't help.
I tried these Power Shell commands:
$1 = Get-childitem "D:\test" -recurse
$2 = Get-childitem "D:\closed_folder_parent" -recurse

I also wanted to write this:
Compare-Object $1 $2 -Property Name, Length

But after the second line, a message appeared:
Get-childitem : Отказано в доступе по пути "D:\closed_folder_parent\closed_folder".
строка:1 знак:6

That is, Power Shell is not an assistant here. What other options are there?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SOTVM, 2020-08-29
@sotvm

That is, Power Shell is not an assistant here. What other options are there?

WSL + How to compare recursively 2 folders in Linux except files by pattern?

P
pindschik, 2020-09-10
@pindschik

There is an assumption that you are trying to treat the effect, not the cause.
Maybe it's worth reformulating the task - "how to make sure that 2 folders are always mirrored, and if they are suddenly not mirrored, then they become so"?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question