List of recently changed files for a directory and all subdirectories
In Linux I know this command to find and list the latest modified files in a directory with all its subdirectories.
find /var/www/ -type f -exec stat --format '%Y :%y %n' {} ; | sort -nr | cut -d: -f2- | head
Is there a Windows CLI equivalent?
windows-7 windows command-line filesystems
add a comment |
In Linux I know this command to find and list the latest modified files in a directory with all its subdirectories.
find /var/www/ -type f -exec stat --format '%Y :%y %n' {} ; | sort -nr | cut -d: -f2- | head
Is there a Windows CLI equivalent?
windows-7 windows command-line filesystems
are you looking for only modified files? Or are you looking at all files?
– Keltari
Feb 2 '13 at 17:25
1
I'm sure PowerShell can do this far more easily than batch, but if you absolutely must use the latter... Trydir /a-d /o-d /tw /s
(show files only, order by date descending, use last write time for sorting, recurse into subdirs). However this will list all files. To limit the list to n latest modified files only, use dbenham's brilliant solution here.
– Karan
Feb 2 '13 at 17:43
A couple of comments on the Linux command: (1) Instead of-exec
, you might want to considerxargs
. (2) If you, as you say, want to sort an entire directory (sub)tree by modification date (and then look at the newest N), then what you have is reasonable. But if you can get the information you need by finding all files modified in the last N days, look atfind … -mtime …
.
– Scott
Feb 2 '13 at 20:41
2
To add to my previous comment, you can also look intoforfiles /s /d +<date>
.
– Karan
Feb 2 '13 at 23:22
add a comment |
In Linux I know this command to find and list the latest modified files in a directory with all its subdirectories.
find /var/www/ -type f -exec stat --format '%Y :%y %n' {} ; | sort -nr | cut -d: -f2- | head
Is there a Windows CLI equivalent?
windows-7 windows command-line filesystems
In Linux I know this command to find and list the latest modified files in a directory with all its subdirectories.
find /var/www/ -type f -exec stat --format '%Y :%y %n' {} ; | sort -nr | cut -d: -f2- | head
Is there a Windows CLI equivalent?
windows-7 windows command-line filesystems
windows-7 windows command-line filesystems
edited Nov 4 '14 at 12:18
nixda
20.9k778133
20.9k778133
asked Feb 2 '13 at 15:06
JohnnyFromBFJohnnyFromBF
2,284154470
2,284154470
are you looking for only modified files? Or are you looking at all files?
– Keltari
Feb 2 '13 at 17:25
1
I'm sure PowerShell can do this far more easily than batch, but if you absolutely must use the latter... Trydir /a-d /o-d /tw /s
(show files only, order by date descending, use last write time for sorting, recurse into subdirs). However this will list all files. To limit the list to n latest modified files only, use dbenham's brilliant solution here.
– Karan
Feb 2 '13 at 17:43
A couple of comments on the Linux command: (1) Instead of-exec
, you might want to considerxargs
. (2) If you, as you say, want to sort an entire directory (sub)tree by modification date (and then look at the newest N), then what you have is reasonable. But if you can get the information you need by finding all files modified in the last N days, look atfind … -mtime …
.
– Scott
Feb 2 '13 at 20:41
2
To add to my previous comment, you can also look intoforfiles /s /d +<date>
.
– Karan
Feb 2 '13 at 23:22
add a comment |
are you looking for only modified files? Or are you looking at all files?
– Keltari
Feb 2 '13 at 17:25
1
I'm sure PowerShell can do this far more easily than batch, but if you absolutely must use the latter... Trydir /a-d /o-d /tw /s
(show files only, order by date descending, use last write time for sorting, recurse into subdirs). However this will list all files. To limit the list to n latest modified files only, use dbenham's brilliant solution here.
– Karan
Feb 2 '13 at 17:43
A couple of comments on the Linux command: (1) Instead of-exec
, you might want to considerxargs
. (2) If you, as you say, want to sort an entire directory (sub)tree by modification date (and then look at the newest N), then what you have is reasonable. But if you can get the information you need by finding all files modified in the last N days, look atfind … -mtime …
.
– Scott
Feb 2 '13 at 20:41
2
To add to my previous comment, you can also look intoforfiles /s /d +<date>
.
– Karan
Feb 2 '13 at 23:22
are you looking for only modified files? Or are you looking at all files?
– Keltari
Feb 2 '13 at 17:25
are you looking for only modified files? Or are you looking at all files?
– Keltari
Feb 2 '13 at 17:25
1
1
I'm sure PowerShell can do this far more easily than batch, but if you absolutely must use the latter... Try
dir /a-d /o-d /tw /s
(show files only, order by date descending, use last write time for sorting, recurse into subdirs). However this will list all files. To limit the list to n latest modified files only, use dbenham's brilliant solution here.– Karan
Feb 2 '13 at 17:43
I'm sure PowerShell can do this far more easily than batch, but if you absolutely must use the latter... Try
dir /a-d /o-d /tw /s
(show files only, order by date descending, use last write time for sorting, recurse into subdirs). However this will list all files. To limit the list to n latest modified files only, use dbenham's brilliant solution here.– Karan
Feb 2 '13 at 17:43
A couple of comments on the Linux command: (1) Instead of
-exec
, you might want to consider xargs
. (2) If you, as you say, want to sort an entire directory (sub)tree by modification date (and then look at the newest N), then what you have is reasonable. But if you can get the information you need by finding all files modified in the last N days, look at find … -mtime …
.– Scott
Feb 2 '13 at 20:41
A couple of comments on the Linux command: (1) Instead of
-exec
, you might want to consider xargs
. (2) If you, as you say, want to sort an entire directory (sub)tree by modification date (and then look at the newest N), then what you have is reasonable. But if you can get the information you need by finding all files modified in the last N days, look at find … -mtime …
.– Scott
Feb 2 '13 at 20:41
2
2
To add to my previous comment, you can also look into
forfiles /s /d +<date>
.– Karan
Feb 2 '13 at 23:22
To add to my previous comment, you can also look into
forfiles /s /d +<date>
.– Karan
Feb 2 '13 at 23:22
add a comment |
3 Answers
3
active
oldest
votes
PowerShell 2.0
Latest 10 changed files
Dir C:folder -r | ? {! $_.PSIsContainer} | sort LastWriteTime | select -last 10
Changed files since given date
Dir C:folder -r | ? {! $_.PSIsContainer -AND $_.lastwritetime -ge '04/18/14'}
Read more on http://ss64.com/ps/
If you just want to show the directories with modified files, do this. Dir d:sftp -r | ? {! $_.PSIsContainer -AND $_.lastwritetime -ge '05/25/2018'} |findstr Directory
– Rob
Jun 15 '18 at 12:05
add a comment |
dir c:windows /aa /s /O-D
Lists all the files with the archive attribute set (modified) in the c:windows folder and all its subfolders by date (newest first)
Edit: This method will only work if you clear the archive bits at some point or the list will just grow and grow.
1
What does the Archive attribute have to do with recently changed files?
– Karan
Feb 2 '13 at 17:10
1
Everything. Any file that gets changed gets the archive attribute set by the OS. Thats how backup programs know that a file has changed and needs to be backed up.
– Keltari
Feb 2 '13 at 17:15
2
Your edit is extremely important. Files with +A already will see no change. Why not find some way to do this based on Date Modified?
– Karan
Feb 2 '13 at 17:24
add a comment |
Take a look at MT Directory Changes Watcher. May be it is right for your needs.
Program watches for file changes in particular directory (Watch
directory) and then copies changed files to another folder (Mirror
directory) saving directory structure. This can be very useful when
you have local copy of remote site and want to upload only files,
changed locally after last upload.
http://mito-team.com/projects/dcw
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%2f545553%2flist-of-recently-changed-files-for-a-directory-and-all-subdirectories%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
PowerShell 2.0
Latest 10 changed files
Dir C:folder -r | ? {! $_.PSIsContainer} | sort LastWriteTime | select -last 10
Changed files since given date
Dir C:folder -r | ? {! $_.PSIsContainer -AND $_.lastwritetime -ge '04/18/14'}
Read more on http://ss64.com/ps/
If you just want to show the directories with modified files, do this. Dir d:sftp -r | ? {! $_.PSIsContainer -AND $_.lastwritetime -ge '05/25/2018'} |findstr Directory
– Rob
Jun 15 '18 at 12:05
add a comment |
PowerShell 2.0
Latest 10 changed files
Dir C:folder -r | ? {! $_.PSIsContainer} | sort LastWriteTime | select -last 10
Changed files since given date
Dir C:folder -r | ? {! $_.PSIsContainer -AND $_.lastwritetime -ge '04/18/14'}
Read more on http://ss64.com/ps/
If you just want to show the directories with modified files, do this. Dir d:sftp -r | ? {! $_.PSIsContainer -AND $_.lastwritetime -ge '05/25/2018'} |findstr Directory
– Rob
Jun 15 '18 at 12:05
add a comment |
PowerShell 2.0
Latest 10 changed files
Dir C:folder -r | ? {! $_.PSIsContainer} | sort LastWriteTime | select -last 10
Changed files since given date
Dir C:folder -r | ? {! $_.PSIsContainer -AND $_.lastwritetime -ge '04/18/14'}
Read more on http://ss64.com/ps/
PowerShell 2.0
Latest 10 changed files
Dir C:folder -r | ? {! $_.PSIsContainer} | sort LastWriteTime | select -last 10
Changed files since given date
Dir C:folder -r | ? {! $_.PSIsContainer -AND $_.lastwritetime -ge '04/18/14'}
Read more on http://ss64.com/ps/
answered May 19 '14 at 18:04
nixdanixda
20.9k778133
20.9k778133
If you just want to show the directories with modified files, do this. Dir d:sftp -r | ? {! $_.PSIsContainer -AND $_.lastwritetime -ge '05/25/2018'} |findstr Directory
– Rob
Jun 15 '18 at 12:05
add a comment |
If you just want to show the directories with modified files, do this. Dir d:sftp -r | ? {! $_.PSIsContainer -AND $_.lastwritetime -ge '05/25/2018'} |findstr Directory
– Rob
Jun 15 '18 at 12:05
If you just want to show the directories with modified files, do this. Dir d:sftp -r | ? {! $_.PSIsContainer -AND $_.lastwritetime -ge '05/25/2018'} |findstr Directory
– Rob
Jun 15 '18 at 12:05
If you just want to show the directories with modified files, do this. Dir d:sftp -r | ? {! $_.PSIsContainer -AND $_.lastwritetime -ge '05/25/2018'} |findstr Directory
– Rob
Jun 15 '18 at 12:05
add a comment |
dir c:windows /aa /s /O-D
Lists all the files with the archive attribute set (modified) in the c:windows folder and all its subfolders by date (newest first)
Edit: This method will only work if you clear the archive bits at some point or the list will just grow and grow.
1
What does the Archive attribute have to do with recently changed files?
– Karan
Feb 2 '13 at 17:10
1
Everything. Any file that gets changed gets the archive attribute set by the OS. Thats how backup programs know that a file has changed and needs to be backed up.
– Keltari
Feb 2 '13 at 17:15
2
Your edit is extremely important. Files with +A already will see no change. Why not find some way to do this based on Date Modified?
– Karan
Feb 2 '13 at 17:24
add a comment |
dir c:windows /aa /s /O-D
Lists all the files with the archive attribute set (modified) in the c:windows folder and all its subfolders by date (newest first)
Edit: This method will only work if you clear the archive bits at some point or the list will just grow and grow.
1
What does the Archive attribute have to do with recently changed files?
– Karan
Feb 2 '13 at 17:10
1
Everything. Any file that gets changed gets the archive attribute set by the OS. Thats how backup programs know that a file has changed and needs to be backed up.
– Keltari
Feb 2 '13 at 17:15
2
Your edit is extremely important. Files with +A already will see no change. Why not find some way to do this based on Date Modified?
– Karan
Feb 2 '13 at 17:24
add a comment |
dir c:windows /aa /s /O-D
Lists all the files with the archive attribute set (modified) in the c:windows folder and all its subfolders by date (newest first)
Edit: This method will only work if you clear the archive bits at some point or the list will just grow and grow.
dir c:windows /aa /s /O-D
Lists all the files with the archive attribute set (modified) in the c:windows folder and all its subfolders by date (newest first)
Edit: This method will only work if you clear the archive bits at some point or the list will just grow and grow.
edited Feb 2 '13 at 17:23
answered Feb 2 '13 at 15:10
KeltariKeltari
51k18118170
51k18118170
1
What does the Archive attribute have to do with recently changed files?
– Karan
Feb 2 '13 at 17:10
1
Everything. Any file that gets changed gets the archive attribute set by the OS. Thats how backup programs know that a file has changed and needs to be backed up.
– Keltari
Feb 2 '13 at 17:15
2
Your edit is extremely important. Files with +A already will see no change. Why not find some way to do this based on Date Modified?
– Karan
Feb 2 '13 at 17:24
add a comment |
1
What does the Archive attribute have to do with recently changed files?
– Karan
Feb 2 '13 at 17:10
1
Everything. Any file that gets changed gets the archive attribute set by the OS. Thats how backup programs know that a file has changed and needs to be backed up.
– Keltari
Feb 2 '13 at 17:15
2
Your edit is extremely important. Files with +A already will see no change. Why not find some way to do this based on Date Modified?
– Karan
Feb 2 '13 at 17:24
1
1
What does the Archive attribute have to do with recently changed files?
– Karan
Feb 2 '13 at 17:10
What does the Archive attribute have to do with recently changed files?
– Karan
Feb 2 '13 at 17:10
1
1
Everything. Any file that gets changed gets the archive attribute set by the OS. Thats how backup programs know that a file has changed and needs to be backed up.
– Keltari
Feb 2 '13 at 17:15
Everything. Any file that gets changed gets the archive attribute set by the OS. Thats how backup programs know that a file has changed and needs to be backed up.
– Keltari
Feb 2 '13 at 17:15
2
2
Your edit is extremely important. Files with +A already will see no change. Why not find some way to do this based on Date Modified?
– Karan
Feb 2 '13 at 17:24
Your edit is extremely important. Files with +A already will see no change. Why not find some way to do this based on Date Modified?
– Karan
Feb 2 '13 at 17:24
add a comment |
Take a look at MT Directory Changes Watcher. May be it is right for your needs.
Program watches for file changes in particular directory (Watch
directory) and then copies changed files to another folder (Mirror
directory) saving directory structure. This can be very useful when
you have local copy of remote site and want to upload only files,
changed locally after last upload.
http://mito-team.com/projects/dcw
add a comment |
Take a look at MT Directory Changes Watcher. May be it is right for your needs.
Program watches for file changes in particular directory (Watch
directory) and then copies changed files to another folder (Mirror
directory) saving directory structure. This can be very useful when
you have local copy of remote site and want to upload only files,
changed locally after last upload.
http://mito-team.com/projects/dcw
add a comment |
Take a look at MT Directory Changes Watcher. May be it is right for your needs.
Program watches for file changes in particular directory (Watch
directory) and then copies changed files to another folder (Mirror
directory) saving directory structure. This can be very useful when
you have local copy of remote site and want to upload only files,
changed locally after last upload.
http://mito-team.com/projects/dcw
Take a look at MT Directory Changes Watcher. May be it is right for your needs.
Program watches for file changes in particular directory (Watch
directory) and then copies changed files to another folder (Mirror
directory) saving directory structure. This can be very useful when
you have local copy of remote site and want to upload only files,
changed locally after last upload.
http://mito-team.com/projects/dcw
edited Jul 1 '15 at 7:18
answered Jun 29 '15 at 9:57
MiSHuTkaMiSHuTka
1013
1013
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%2f545553%2flist-of-recently-changed-files-for-a-directory-and-all-subdirectories%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
are you looking for only modified files? Or are you looking at all files?
– Keltari
Feb 2 '13 at 17:25
1
I'm sure PowerShell can do this far more easily than batch, but if you absolutely must use the latter... Try
dir /a-d /o-d /tw /s
(show files only, order by date descending, use last write time for sorting, recurse into subdirs). However this will list all files. To limit the list to n latest modified files only, use dbenham's brilliant solution here.– Karan
Feb 2 '13 at 17:43
A couple of comments on the Linux command: (1) Instead of
-exec
, you might want to considerxargs
. (2) If you, as you say, want to sort an entire directory (sub)tree by modification date (and then look at the newest N), then what you have is reasonable. But if you can get the information you need by finding all files modified in the last N days, look atfind … -mtime …
.– Scott
Feb 2 '13 at 20:41
2
To add to my previous comment, you can also look into
forfiles /s /d +<date>
.– Karan
Feb 2 '13 at 23:22