473,320 Members | 1,976 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Search for a Directory by date.

(I have this posted in VB forum as well and no luck so far, thats why Im poting here - I am using VB.Net on XP).
I have a third party program that runs several scheduled batch routines every night. Each type of batch routine creates a folder in the C:\Temp directory. Inside the folders are error reports that are txt files. I am writing a program that will also be run as a scheduled routine, but it will look for the most recent set of folders (tg*, ar*, mdb* are the folder strings) and read the txt files looking for certain strings. If the strings exist it will write the string out to a separate file and that file will contain a listing of all errors for all scheduled batch routines. That file will in turn either be emailed to myself or I will have a shortcut to it on my desktop so I can open it first thing in the morning to find out if any of the routines had errors.

Now that I have thoroughly confused everyone, I need to know how to search for a folder with the above string by date. I have the following code which I thought would do it but I keep getting a SecurityException error at line 10 (Dim dDir) and I don’t know how to get around it.


Code: ( vbnet )
Expand|Select|Wrap|Line Numbers
  1. Dim dteDate As Date
  2. Dim fldTemp as String
  3.  
  4. 'Hard code directory just for example
  5. fldTemp = "c:\temp\ar123456"
  6.  
  7. 'Set date to yesterdays date.
  8. dteDate = Today().AddDays(-1)
  9.  
  10. Dim dDir As New DirectoryInfo(fldTemp)
  11. MsgBox("Last access time was " & dDir.LastAccessTime)
  12.  
Feb 1 '08 #1
1 973
Plater
7,872 Expert 4TB
Are the directories actually on a REMOTE system that you are accesing with network shares? (say "\\someserver\temp\ar20080130\" or whatever)?
Actually I guess it would apply to local files too, depending on the "user" credentials the application is running on.

Also for this:
Expand|Select|Wrap|Line Numbers
  1. fldTemp = "c:\temp\ar123456"
In C# we would either need to say
Expand|Select|Wrap|Line Numbers
  1. fldTemp = "c:\\temp\\ar123456" 
  2. or 
  3. fldTemp = @"c:\temp\ar123456"
  4.  
to let the compiler know that the \ means "\" and not "escape the next character". Does the same apply for vbnet?
Feb 1 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Greg | last post by:
I have a page that searches a database by a repairman's name and by a date range. It pulls info by the repairman's name but pulls all info in the database regardless of the date. Below is the code...
2
by: Vai2000 | last post by:
Hi All, Is there a way to search for files within a specific date range and pattern. I know the later but don't know how to enforce the date range in searching files in a given dir. TIA
0
by: Glen Darling | last post by:
Morning everyone, I am looking for help with an active directory search I am trying to figure out. For a while now I have been banging my head against a wall trying to figure out how to...
1
by: Eric | last post by:
Hi: I have two files. I search pattern ":" from emails text file and save email contents into a database. Another search pattern " field is blank. Please try again.", vbExclamation + vbOKOnly...
12
by: Eric Renken | last post by:
I have an application that I am adding support for plug-ins and I am looking for some help on the best way to handle this. My question has to do with AppDomains and the best way to use them. I...
1
by: FFMG | last post by:
Hi, I have some cached pages and I want to display how long ago certain articles were written. But how can I display "This article was written 'yyy days' ago" when the whole page is cached? ...
4
by: Sutharsan Nagasun | last post by:
Hi, I am new to Perl. I need help with file search for the following scenario. Currently as part of the archiving process, we have archived the files under /$rootdir/Archive/yyyy directory where...
5
by: manish | last post by:
HI I want a jawascript that will search pages from only my subdomain website eg. abc.efg.com can anyone help me please give the exact jawascript as I am not an expert programmer please if...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.