Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
you can do a vbscript. or if you can download and install findutils for windows here : http://gnuwin32.sourceforge.net/pac...
you can use it to find files modified during the last 3 days
c:\test> find c:\path -type f -mtime -3 -print

Thanx ghostdog,
I already have my batch file that does quite some work on existing files, but I need to filter files to work only on last modified ones instead of working on all the files on a folder.

you can incorporate find in your batch file too. Unless you have a restriction of downloading and installing third party tools.

That's unfortunately the case, I have already thaught about third party soft to incorporate that functionality but I'm not allowad to install anything on the production server

I agree; it's much safer to run random scripts you get from anonymous people in an online Internet forum on a production environment.
This VBScript will list all files in a directory you specify modified within the number of days you specify, with 0 being today. This script goes by calendar days, not 24 hours == 1 day; failure to specify means I'm left guessing. It'll write to standard out if you use CSCRIPT; out.txt if not. While this script isn't my best work, it'll do.
If WScript.Arguments.Unnamed.Count = 0 Then _
WScript.Quit 1chkDate = WScript.Arguments.Named.Exists("time")
If chkDate Then
cutoff = CDate(Int(Now) - WScript.Arguments.Named("time"))
Else
cutoff = 0
End If
With CreateObject("Scripting.FileSystemObject")
On Error Resume Next
WScript.StdOut.WriteLine ""
If Err = 0 Then
Set out = WScript.StdOut
Else
Err.Clear
Set out = .CreateTextFile("out.txt", True)
If Err > 0 Then _
WScript.Quit 255
End If
On Error GoTo 0
For Each f In .GetFolder(WScript.Arguments.Unnamed(0)).Files
If Not chkDate Or f.DateLastModified >= cutoff Then _
out.WriteLine f
Next
End WithSuggested use:
CSCRIPT <script>.vbs //NOLOGO <path> /time:3

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |