Difference in files and folders at two different times (Windows)
I would like to see how many files and folders have been changed (including created, deleted and modified), list of changed files and folders with their size before and after.
So is there a utility tool (or script ?) which I could run at two different times and then get the difference ?
windows powershell cmd.exe ntfs
add a comment |
I would like to see how many files and folders have been changed (including created, deleted and modified), list of changed files and folders with their size before and after.
So is there a utility tool (or script ?) which I could run at two different times and then get the difference ?
windows powershell cmd.exe ntfs
This is a very specific request, so, nope to a pre-canned tool. You are going to have to write this yourself. So, do some searches using your favorite search engine for each segment of your use case, to build out a script then test it, and if you then have issues, come back a see us with the code and the errors. Just search for PowerShell file and folder management as well as file and folder monitoring as well. A lot of this is in the help files on your system as well. Just look up Get-ChildItem, to get going.
– postanote
Dec 17 '18 at 10:24
@postanote thanks for comment. Btw, I'm open also to tools which do not cover all the aspects I mentioned...
– OrangeSpider
Dec 17 '18 at 10:56
You can use Treesize. It allows saving a snapshot of the files in the system at a given time and compare that to a snapshot from another time.
– Lieven Keersmaekers
Dec 17 '18 at 11:21
add a comment |
I would like to see how many files and folders have been changed (including created, deleted and modified), list of changed files and folders with their size before and after.
So is there a utility tool (or script ?) which I could run at two different times and then get the difference ?
windows powershell cmd.exe ntfs
I would like to see how many files and folders have been changed (including created, deleted and modified), list of changed files and folders with their size before and after.
So is there a utility tool (or script ?) which I could run at two different times and then get the difference ?
windows powershell cmd.exe ntfs
windows powershell cmd.exe ntfs
asked Dec 17 '18 at 10:16
OrangeSpiderOrangeSpider
163
163
This is a very specific request, so, nope to a pre-canned tool. You are going to have to write this yourself. So, do some searches using your favorite search engine for each segment of your use case, to build out a script then test it, and if you then have issues, come back a see us with the code and the errors. Just search for PowerShell file and folder management as well as file and folder monitoring as well. A lot of this is in the help files on your system as well. Just look up Get-ChildItem, to get going.
– postanote
Dec 17 '18 at 10:24
@postanote thanks for comment. Btw, I'm open also to tools which do not cover all the aspects I mentioned...
– OrangeSpider
Dec 17 '18 at 10:56
You can use Treesize. It allows saving a snapshot of the files in the system at a given time and compare that to a snapshot from another time.
– Lieven Keersmaekers
Dec 17 '18 at 11:21
add a comment |
This is a very specific request, so, nope to a pre-canned tool. You are going to have to write this yourself. So, do some searches using your favorite search engine for each segment of your use case, to build out a script then test it, and if you then have issues, come back a see us with the code and the errors. Just search for PowerShell file and folder management as well as file and folder monitoring as well. A lot of this is in the help files on your system as well. Just look up Get-ChildItem, to get going.
– postanote
Dec 17 '18 at 10:24
@postanote thanks for comment. Btw, I'm open also to tools which do not cover all the aspects I mentioned...
– OrangeSpider
Dec 17 '18 at 10:56
You can use Treesize. It allows saving a snapshot of the files in the system at a given time and compare that to a snapshot from another time.
– Lieven Keersmaekers
Dec 17 '18 at 11:21
This is a very specific request, so, nope to a pre-canned tool. You are going to have to write this yourself. So, do some searches using your favorite search engine for each segment of your use case, to build out a script then test it, and if you then have issues, come back a see us with the code and the errors. Just search for PowerShell file and folder management as well as file and folder monitoring as well. A lot of this is in the help files on your system as well. Just look up Get-ChildItem, to get going.
– postanote
Dec 17 '18 at 10:24
This is a very specific request, so, nope to a pre-canned tool. You are going to have to write this yourself. So, do some searches using your favorite search engine for each segment of your use case, to build out a script then test it, and if you then have issues, come back a see us with the code and the errors. Just search for PowerShell file and folder management as well as file and folder monitoring as well. A lot of this is in the help files on your system as well. Just look up Get-ChildItem, to get going.
– postanote
Dec 17 '18 at 10:24
@postanote thanks for comment. Btw, I'm open also to tools which do not cover all the aspects I mentioned...
– OrangeSpider
Dec 17 '18 at 10:56
@postanote thanks for comment. Btw, I'm open also to tools which do not cover all the aspects I mentioned...
– OrangeSpider
Dec 17 '18 at 10:56
You can use Treesize. It allows saving a snapshot of the files in the system at a given time and compare that to a snapshot from another time.
– Lieven Keersmaekers
Dec 17 '18 at 11:21
You can use Treesize. It allows saving a snapshot of the files in the system at a given time and compare that to a snapshot from another time.
– Lieven Keersmaekers
Dec 17 '18 at 11:21
add a comment |
1 Answer
1
active
oldest
votes
With PowerShell it's not too difficult to just combine some cmdlets.
Get-ChildItem
to get the folder/file tree into an object,- using
Export-Clixml/Import-Clixml
to store an object in a file
(the xml files will take up some space), - and
Compare-Object
to compare the most recent with the current tree.
## Q:Test20181217SU_1385185.ps1
$Base = 'C:Test'
$ArchiveFolder = $Env:tmp
function Archive-Tree {
$File = "{0}Tree_{1:yyyyMMddHHmmss}.CliXML" -f $ArchiveFolder,[datetime]::Now
Get-ChildItem -Path $Base -Recurse | Export-Clixml $File
$File
}
## ----- get most recent file Tree_*.clixml
$File = Get-ChildItem "$($Env:tmp)Tree_*.Clixml" | Select-Object -Last 1
if ($File){
$Old = Import-Clixml $File
$New = Import-Clixml (Archive-Tree)
Compare-Object -Ref $Old -Dif $New -Property FullName,
Length,LastWriteTime,CreationTime,LastAccessTime |
Sort-Object FullName,SideIndicator | Format-Table -AutoSize
} else {
$File = (Archive-Tree)
"No saved tree, now created as {0}" -f $File
}
Sample output
FullName Length LastWriteTime CreationTime LastAccessTime SideIndicator
-------- ------ ------------- ------------ -------------- -------------
C:testc_test.clixml 982258 2018-12-17 12:59:27 2018-12-17 12:59:24 2018-12-17 12:59:24 =>
C:testc_test.clixml 0 2018-12-17 12:59:24 2018-12-17 12:59:24 2018-12-17 12:59:24 <=
C:Testfoo.baz 1164 2018-12-17 13:55:05 2018-12-17 13:55:21 2018-12-17 13:55:21 =>
The SideIndicator <=
references the LHS or -ReferenceObject ($OLD
),
the SideIndicator =>
the RHS or -DifferenceObject ($New
).
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1385185%2fdifference-in-files-and-folders-at-two-different-times-windows%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
With PowerShell it's not too difficult to just combine some cmdlets.
Get-ChildItem
to get the folder/file tree into an object,- using
Export-Clixml/Import-Clixml
to store an object in a file
(the xml files will take up some space), - and
Compare-Object
to compare the most recent with the current tree.
## Q:Test20181217SU_1385185.ps1
$Base = 'C:Test'
$ArchiveFolder = $Env:tmp
function Archive-Tree {
$File = "{0}Tree_{1:yyyyMMddHHmmss}.CliXML" -f $ArchiveFolder,[datetime]::Now
Get-ChildItem -Path $Base -Recurse | Export-Clixml $File
$File
}
## ----- get most recent file Tree_*.clixml
$File = Get-ChildItem "$($Env:tmp)Tree_*.Clixml" | Select-Object -Last 1
if ($File){
$Old = Import-Clixml $File
$New = Import-Clixml (Archive-Tree)
Compare-Object -Ref $Old -Dif $New -Property FullName,
Length,LastWriteTime,CreationTime,LastAccessTime |
Sort-Object FullName,SideIndicator | Format-Table -AutoSize
} else {
$File = (Archive-Tree)
"No saved tree, now created as {0}" -f $File
}
Sample output
FullName Length LastWriteTime CreationTime LastAccessTime SideIndicator
-------- ------ ------------- ------------ -------------- -------------
C:testc_test.clixml 982258 2018-12-17 12:59:27 2018-12-17 12:59:24 2018-12-17 12:59:24 =>
C:testc_test.clixml 0 2018-12-17 12:59:24 2018-12-17 12:59:24 2018-12-17 12:59:24 <=
C:Testfoo.baz 1164 2018-12-17 13:55:05 2018-12-17 13:55:21 2018-12-17 13:55:21 =>
The SideIndicator <=
references the LHS or -ReferenceObject ($OLD
),
the SideIndicator =>
the RHS or -DifferenceObject ($New
).
add a comment |
With PowerShell it's not too difficult to just combine some cmdlets.
Get-ChildItem
to get the folder/file tree into an object,- using
Export-Clixml/Import-Clixml
to store an object in a file
(the xml files will take up some space), - and
Compare-Object
to compare the most recent with the current tree.
## Q:Test20181217SU_1385185.ps1
$Base = 'C:Test'
$ArchiveFolder = $Env:tmp
function Archive-Tree {
$File = "{0}Tree_{1:yyyyMMddHHmmss}.CliXML" -f $ArchiveFolder,[datetime]::Now
Get-ChildItem -Path $Base -Recurse | Export-Clixml $File
$File
}
## ----- get most recent file Tree_*.clixml
$File = Get-ChildItem "$($Env:tmp)Tree_*.Clixml" | Select-Object -Last 1
if ($File){
$Old = Import-Clixml $File
$New = Import-Clixml (Archive-Tree)
Compare-Object -Ref $Old -Dif $New -Property FullName,
Length,LastWriteTime,CreationTime,LastAccessTime |
Sort-Object FullName,SideIndicator | Format-Table -AutoSize
} else {
$File = (Archive-Tree)
"No saved tree, now created as {0}" -f $File
}
Sample output
FullName Length LastWriteTime CreationTime LastAccessTime SideIndicator
-------- ------ ------------- ------------ -------------- -------------
C:testc_test.clixml 982258 2018-12-17 12:59:27 2018-12-17 12:59:24 2018-12-17 12:59:24 =>
C:testc_test.clixml 0 2018-12-17 12:59:24 2018-12-17 12:59:24 2018-12-17 12:59:24 <=
C:Testfoo.baz 1164 2018-12-17 13:55:05 2018-12-17 13:55:21 2018-12-17 13:55:21 =>
The SideIndicator <=
references the LHS or -ReferenceObject ($OLD
),
the SideIndicator =>
the RHS or -DifferenceObject ($New
).
add a comment |
With PowerShell it's not too difficult to just combine some cmdlets.
Get-ChildItem
to get the folder/file tree into an object,- using
Export-Clixml/Import-Clixml
to store an object in a file
(the xml files will take up some space), - and
Compare-Object
to compare the most recent with the current tree.
## Q:Test20181217SU_1385185.ps1
$Base = 'C:Test'
$ArchiveFolder = $Env:tmp
function Archive-Tree {
$File = "{0}Tree_{1:yyyyMMddHHmmss}.CliXML" -f $ArchiveFolder,[datetime]::Now
Get-ChildItem -Path $Base -Recurse | Export-Clixml $File
$File
}
## ----- get most recent file Tree_*.clixml
$File = Get-ChildItem "$($Env:tmp)Tree_*.Clixml" | Select-Object -Last 1
if ($File){
$Old = Import-Clixml $File
$New = Import-Clixml (Archive-Tree)
Compare-Object -Ref $Old -Dif $New -Property FullName,
Length,LastWriteTime,CreationTime,LastAccessTime |
Sort-Object FullName,SideIndicator | Format-Table -AutoSize
} else {
$File = (Archive-Tree)
"No saved tree, now created as {0}" -f $File
}
Sample output
FullName Length LastWriteTime CreationTime LastAccessTime SideIndicator
-------- ------ ------------- ------------ -------------- -------------
C:testc_test.clixml 982258 2018-12-17 12:59:27 2018-12-17 12:59:24 2018-12-17 12:59:24 =>
C:testc_test.clixml 0 2018-12-17 12:59:24 2018-12-17 12:59:24 2018-12-17 12:59:24 <=
C:Testfoo.baz 1164 2018-12-17 13:55:05 2018-12-17 13:55:21 2018-12-17 13:55:21 =>
The SideIndicator <=
references the LHS or -ReferenceObject ($OLD
),
the SideIndicator =>
the RHS or -DifferenceObject ($New
).
With PowerShell it's not too difficult to just combine some cmdlets.
Get-ChildItem
to get the folder/file tree into an object,- using
Export-Clixml/Import-Clixml
to store an object in a file
(the xml files will take up some space), - and
Compare-Object
to compare the most recent with the current tree.
## Q:Test20181217SU_1385185.ps1
$Base = 'C:Test'
$ArchiveFolder = $Env:tmp
function Archive-Tree {
$File = "{0}Tree_{1:yyyyMMddHHmmss}.CliXML" -f $ArchiveFolder,[datetime]::Now
Get-ChildItem -Path $Base -Recurse | Export-Clixml $File
$File
}
## ----- get most recent file Tree_*.clixml
$File = Get-ChildItem "$($Env:tmp)Tree_*.Clixml" | Select-Object -Last 1
if ($File){
$Old = Import-Clixml $File
$New = Import-Clixml (Archive-Tree)
Compare-Object -Ref $Old -Dif $New -Property FullName,
Length,LastWriteTime,CreationTime,LastAccessTime |
Sort-Object FullName,SideIndicator | Format-Table -AutoSize
} else {
$File = (Archive-Tree)
"No saved tree, now created as {0}" -f $File
}
Sample output
FullName Length LastWriteTime CreationTime LastAccessTime SideIndicator
-------- ------ ------------- ------------ -------------- -------------
C:testc_test.clixml 982258 2018-12-17 12:59:27 2018-12-17 12:59:24 2018-12-17 12:59:24 =>
C:testc_test.clixml 0 2018-12-17 12:59:24 2018-12-17 12:59:24 2018-12-17 12:59:24 <=
C:Testfoo.baz 1164 2018-12-17 13:55:05 2018-12-17 13:55:21 2018-12-17 13:55:21 =>
The SideIndicator <=
references the LHS or -ReferenceObject ($OLD
),
the SideIndicator =>
the RHS or -DifferenceObject ($New
).
answered Dec 17 '18 at 13:22
LotPingsLotPings
4,7161722
4,7161722
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1385185%2fdifference-in-files-and-folders-at-two-different-times-windows%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This is a very specific request, so, nope to a pre-canned tool. You are going to have to write this yourself. So, do some searches using your favorite search engine for each segment of your use case, to build out a script then test it, and if you then have issues, come back a see us with the code and the errors. Just search for PowerShell file and folder management as well as file and folder monitoring as well. A lot of this is in the help files on your system as well. Just look up Get-ChildItem, to get going.
– postanote
Dec 17 '18 at 10:24
@postanote thanks for comment. Btw, I'm open also to tools which do not cover all the aspects I mentioned...
– OrangeSpider
Dec 17 '18 at 10:56
You can use Treesize. It allows saving a snapshot of the files in the system at a given time and compare that to a snapshot from another time.
– Lieven Keersmaekers
Dec 17 '18 at 11:21