|
|
|
Searching for unmodified files.
|
Original Message
|
Name: Qcumber
Date: March 9, 2006 at 05:45:17 Pacific
Subject: Searching for unmodified files.OS: XP ProCPU/Ram: naModel/Manufacturer: na |
Comment: Hi all, Can anyone help with this please? Im using Win XP Pro and need to find a way to search for files that have remained unmodified between two dates. Is this possible? Many thanks, Qcumber
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: Michael J (by mjdamato)
Date: March 9, 2006 at 07:26:17 Pacific
|
Reply: (edit)Two things: You need to include a little more information. For example, are you looking ror some type of batch script, or is there a particular language or manner this will be used. Second, "for files that have remained unmodified between two dates". That is impossible. For example, if you are looking for files that were not modified from Jan 1 to Jan 31, but you have a file who's last modified date was Feb. 5, there is no way to determine if that file was modified during January or not. It IS possible to determine that the LAST MODIFIED date was not in that period. But, that's about all. if you want to know every instance a file was modified, you will need to run some type of logging process to track that activity. Michael J
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: Qcumber
Date: March 9, 2006 at 09:29:18 Pacific
|
Reply: (edit)Ok I'll try to provide more info. I'm using Veritas Netbackup to backup the contents of users desktops. Each user gets a quota of network storage space and (you guessed it) i get users asking for more space because they cannot be bothered to "clean up". I'd like to run a script that will list every file that has not been modified between two dates so that i can go back to the user and say "These files are not being used and are taking up space etc etc". The only way i can do that at the moment is to invite the user to my workstation and show them which i dont want to do. The Netbackup product cannot produce this type of report hence my request. Cheers Qcumber.
Report Offensive Follow Up For Removal
|
|
Response Number 3
|
Name: FishMonger
Date: March 9, 2006 at 11:33:43 Pacific
|
Reply: (edit)You can not test if a file has or has not been modified between arbitrary dates. You can get the atime and/or mtime of the file and find out how how much time has elapsed since the file has been accessed or modified. In your case, you may want to do both. I have lots of files that I need to access (read), but not modify. This link talks about the different timestamps. It's refering to unix, but it's the same on Windows. http://www.unix.com/showthread.php?p=79750#post79750 You need to tell us which language you want to use...a batch file would not be the a proper choice.
Report Offensive Follow Up For Removal
|
|
Response Number 4
|
Name: FishMonger
Date: March 9, 2006 at 11:39:18 Pacific
|
Reply: (edit)I should have mentioned, my choice would be to use Perl. Perl has easy to use methods for doing this type of test and report generating.
Report Offensive Follow Up For Removal
|
|
Response Number 5
|
Name: Michael J (by mjdamato)
Date: March 9, 2006 at 11:41:10 Pacific
|
Reply: (edit)Are you doing full backups each time. Just a suggestion, but would it not be easier to just configure the backup to only backup files that have been modified since the last backup (i.e. incremental backup)? Well, here's something to get you started. Just copy and past the code below into a text document and name with a vbs extension. You will need to edit the path and date values of the items in blue. ***** BEGIN CODE ***** Dim objFSO, objStream, target, startDate, endDate
target = "C:\pathtofolder\" startDate = "1/1/2004" endDate = "4/1/2004"
Set objFSO = CreateObject("scripting.filesystemobject") 'create the output file Set objStream = objFSO.createtextfile("c:\search.log", True) CheckFolder (objFSO.getfolder (target)), objStream MsgBox "File Search Completed." + vbCr + "Please check c:\search.log for details." '============================ Sub CheckFolder(objCurrentFolder, objLogFile)
sDate = DateValue(startDate+" 12:00:00 AM") eDate = DateValue(endDate+" 12:59:59 PM") Dim strOutput, objNewFolder, objFile, objStream For Each objFile In objCurrentFolder.Files If (objFile.datelastmodified >= sDate AND objFile.datelastmodified<= eDate) Then strOutput = CStr(objFile.Name) + ", " + CStr(objFile.Path) + ", " _ + CStr(objFile.Size) + ", " + CStr(objFile.datelastmodified) objLogFile.writeline strOutput End If Next 'Recurse through all of the subfolders For Each objNewFolder In objCurrentFolder.subFolders CheckFolder objNewFolder, objLogFile Next End Sub '============================ ***** END CODE ***** Michael J
Report Offensive Follow Up For Removal
|
|
Response Number 6
|
Name: Qcumber
Date: March 10, 2006 at 09:32:16 Pacific
|
Reply: (edit)Thanks for the replies everyone. Michael J - Many thanks for that code. I'll give it a try over the weekend. Have a good weekend y'all :-) Qcumber.
Report Offensive Follow Up For Removal
|
|
Response Number 7
|
Name: Mechanix2Go
Date: March 12, 2006 at 01:45:56 Pacific
|
Reply: (edit)Hi Gang, As per earlier replies, It seems more straightforward to do incremental backups. xcopy has the ability to: [1] modify the a [archive] bit [2] copy files modified after a specified date One or the other or a combination should do the trick. This bat will do the rudimentary checking. You need to tailor it to your date layout, paths etc. ::== modwhen.bat @echo off if %2'==' goto :syntax set startDATE=%1 set endDATE=%2 :main
dir /a-d > list find "-200" < list > list2 for /f "tokens=*" %%F in (list2) do call :sub1 %%F goto :eof :sub1 set rawDATE=%1 ::echo rawDATE=%rawDATE% set workDATE=%rawDATE:~6,4%%rawDATE:~3,2%%rawDATE:~0,2% ::echo workDATE=%workDATE% set fNAME=%4 ::echo fNAME=%fNAME% if %workDATE% LSS %endDATE% echo %fNAME% is before %endDATE% if %workDATE% GTR %endDATE% echo %fNAME% is after %endDATE% goto :eof :syntax echo %0 takes 2 parameters, startDATE and endDATE in the form YYYYMMDD :: DONE
If at first you don't succeed, you're about average.M2
Report Offensive Follow Up For Removal
|

|

|
Use following form to reply to current message:
|
|

|