473,758 Members | 2,340 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Searching for a directory by date

12 New Member
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 SecurityExcepti on error and I don’t know how to get around it.

Expand|Select|Wrap|Line Numbers
  1. Dim dteDate As Date
  2. Dim strFldr as String
  3.  
  4. 'Hard code directory just for example
  5. strFldr = 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)
Jan 30 '08 #1
8 1571
Killer42
8,435 Recognized Expert Expert
Is this the actual code, or did you just type an approximation here? Because it looks to me as though line 5 wouldn't even compile (needs quotes).

And which line produces the error?
Jan 30 '08 #2
jcopeland38053
12 New Member
Is this the actual code, or did you just type an approximation here? Because it looks to me as though line 5 wouldn't even compile (needs quotes).

And which line produces the error?
In retyping I misssed the quotes. And I get the Security Exception error at line 10, the Dim statement.
Jan 30 '08 #3
Killer42
8,435 Recognized Expert Expert
My guess is the fldTemp in line 10 should be strFldr.

Beyond that, I think we'll need some input from someone who actually uses a later version than VB6.
Jan 31 '08 #4
Killer42
8,435 Recognized Expert Expert
In retyping I misssed the quotes. And I get the Security Exception error at line 10, the Dim statement.
This is why we prefer copy and paste where possible. :) We often end up chasing a problem that actually doesn't exist in the code.
Jan 31 '08 #5
jcopeland38053
12 New Member
This is why we prefer copy and paste where possible. :) We often end up chasing a problem that actually doesn't exist in the code.

Thanks for the tip.
And as to the name of the variable, you were correct, however i still get the same error after fixing that. Im stuck.
Feb 1 '08 #6
daniel aristidou
491 Contributor
Are the files located in a security tight area??...
Feb 1 '08 #7
VACEPROGRAMER
168 New Member
Can you say do you using VB6 or 5 Or VB.net. I got a specaly code for you. I have made same program but I use for conttrol the OS "C:\WINDOWS\Sys tem32


*VACE*
Feb 2 '08 #8
Killer42
8,435 Recognized Expert Expert
Thanks for the tip.
And as to the name of the variable, you were correct, however i still get the same error after fixing that. Im stuck.
Can you show us the actual code? So far I think we've fixed two problems that were in it.
Feb 2 '08 #9

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

Similar topics

5
3341
by: Ken Fine | last post by:
I want my application to maintain a directory tree based on months and years, e.g.: 2004 January file file file February file
8
2590
by: James Owens | last post by:
I'm a relative newbie, interested in storing the information from several server directories and subdirectories in XML so that I can present it selectively using XSL (all files updated today or last MOnday, files from several drirectories in alphabetical order, things like that). To represent directories and subidrectories, is it advisable to nest the same element: <directory> <directory>
6
5182
by: JerryP | last post by:
Hello, is there a way to launch the property dialogue for a directory from my c# app ? I would also like to launch the User Account Properties from Active Directory Users and Computers, and the properties window for an Object in Active Directory. Thanks for any hints.
1
1182
by: trialproduct2004 | last post by:
Hi all, I am having C# application which is accepting file name and directory name. What i want is to check whether file present in given directory or not. Directory can have sudirectories in it. So i want searching to be for innnermost folder also.
5
2405
by: justobservant | last post by:
When more than one keyword is typed into a search-query, most of the search-results displayed indicate specified keywords scattered throughout an entire website of content i.e., this is shown as three bolded periods '...' in search-result listings. Additionally, most content is outdated; as many users need up-to-date content. Hence, filtering-through search-results becomes quite cumbersome. The newsgroup listings allow detailed...
3
3289
by: Aaron | last post by:
I'm trying to parse a table on a webpage to pull down some data I need. The page is based off of information entered into a form. when you submit the data from the form it displays a "Searching..." page then, refreshes and displays the table I want. I have code that grabs data from the page using cURL but when I look at the data it contains the "Searching..." page and not the table that I want. below is the code i have so far....Thanks...
1
1169
by: Timothy | last post by:
Hi All, Please everyone this is my humble request to all of you if you please have idea about my question then please help me with your master ideas. I have requirement that i should either have windows or ASP.NET Application using VC# - there is start date and end date and there would be three checkbox - 1Created Date 2 Modified Date 3 Accessed Date there are the type of file Access specification into our windows system and i want to...
7
4074
by: Stephenoja | last post by:
Hello Guys, I have a challenge here and would really appreciate some help. I have customer bills that are all done in excel with a template and stored in directories by month order. At the end of the month or periodically, I need to query and print a report giving customer name, account number, date of service and cost for a particular service/item for all customers who received such a service/item (at times up to 300 customer bills in...
4
1602
by: jodleren | last post by:
Hi! I wonder, which way to do this fastest. I have a disk, where I need to search for a file or directory. I do it recursively, meaning that I start from the top dir, then I add all directories to an array, and by a counter I work my way through that array. And, while doing that I add the directory or file (name) to and result
0
9299
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9740
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8744
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7287
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5332
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3832
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3402
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2702
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.