PC Review


Reply
Thread Tools Rate Thread

automate file searches

 
 
=?Utf-8?B?bWk=?=
Guest
Posts: n/a
 
      1st Nov 2004
Hello,

I was wondering if there was an easy way to automate a file search.
Specifically, I'm looking to do something like this: execute a search at
midnight to find all files modified on the D: drive during the previous day.
Ideally, the output would go to a text file that I can then view in the
morning.

I currently do this using the gui, but it takes a while to search through
the large number of files. Also, the output tends to change during the
search as people modify files on the drive. I was thinking of something like
dir /od, except that would list all the files on the drive, instead of just
those modified during the previous day. Are there any other command line
tools I can use for this?

Thank you,
Mike
 
Reply With Quote
 
 
 
 
Jerold Schulman
Guest
Posts: n/a
 
      1st Nov 2004
On Mon, 1 Nov 2004 07:58:03 -0800, "mi" <(E-Mail Removed)> wrote:

>Hello,
>
>I was wondering if there was an easy way to automate a file search.
>Specifically, I'm looking to do something like this: execute a search at
>midnight to find all files modified on the D: drive during the previous day.
>Ideally, the output would go to a text file that I can then view in the
>morning.
>
>I currently do this using the gui, but it takes a while to search through
>the large number of files. Also, the output tends to change during the
>search as people modify files on the drive. I was thinking of something like
>dir /od, except that would list all the files on the drive, instead of just
>those modified during the previous day. Are there any other command line
>tools I can use for this?
>
>Thank you,
>Mike



Schedule one of the following batches, which uses DatePorM.bat from tip 8293 in the 'Tips & Tricks' at http://www.jsiinc.com

This batch relies on the archive bit being set. A full backup will unset it.
@echo off
setlocal
If exist c:\folder\Yesterday.txt del /q c:\folder\Yesterday.txt
call DatePorM -1 Yesterday
for /f "Tokens=*" %%f in ('dir D: /b /s /aa') do (
call :test "%%f"
)
endlocal
goto :EOF
:test
for /f "Tokens=1*" %%y in ('dir %1 /TW^|find /I "%~nx1"') do (
if "%%y" EQU "%Yesterday%" @echo %1>>c:\folder\Yesterday.txt
)

This batch runs longer, but doesn't test the archive bit:
@echo off
setlocal
If exist c:\folder\Yesterday.txt del /q c:\folder\Yesterday.txt
call DatePorM -1 Yesterday
for /f "Tokens=*" %%f in ('dir D: /b /s ') do (
call :test "%%f"
)
endlocal
goto :EOF
:test
for /f "Tokens=1*" %%y in ('dir %1 /TW^|find /I "%~nx1"') do (
if "%%y" EQU "%Yesterday%" @echo %1>>c:\folder\Yesterday.txt
)

Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Warning: Control f in Windows 8 no longer searches a specificframes, it now searches all frames long time windows user Windows Vista General Discussion 3 9th Feb 2010 02:41 AM
what is with file search on XP? It seems like it searches all types of files, has no sense about what is searches first, takes FOREVER, on windows 98 a file search took about 1/1000 the time. Fact Attack Windows XP General 2 31st Aug 2006 12:13 AM
Getting valid web searches and avoiding sites that contaminate web searches David McRitchie Microsoft Excel New Users 1 13th Jun 2006 03:00 AM
Is there a way to automate google searches into excel? bxc2739 Microsoft Excel Misc 4 24th Apr 2006 05:12 PM
File Searches Paul Gurdin Microsoft Excel Programming 1 3rd Oct 2003 10:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:58 AM.