473,795 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FileSystemWatch er: Fix for lowercase?

Hi,
As most people who use the FileSystemWatch er know, it returns lowercase text
for some strange reason. I know there's a workaround for the lowercase the
FileSystemWatch er returns by by passing the 'FullPath' property into the
constructor of a DirectoryInfo Class and reading the 'Name' property but I'm
not sure how or where I'd fit that into my code.
Could someone point me in the right direction?

Cheers,
Paul

Code follows........ ..

Private Sub LogChange(ByVal source As Object, ByVal e As
FileSystemEvent Args)
Dim strDestDir As String = "D:\"
Dim strString As String

Select Case e.ChangeType
Case IO.WatcherChang eTypes.Created
Try
If File.Exists(str DestDir & e.Name) = True Then
'File already exists in dest dir, wait for new file to
become available/not locked then delete it
Do Until FileIsReady(e.F ullPath) = True
Loop
File.Delete(e.F ullPath)
Exit Sub
Else
'File doesn't exist, wait for new file to become
available then move it.
Do Until FileIsReady(e.F ullPath) = True
Loop
'Call popup form passing full path (lowercase for some
reason)
Popup(e.FullPat h)
File.Move(e.Ful lPath, strDestDir & e.Name)
End If
Catch indexProblem As IndexOutOfRange Exception
MsgBox("Error - No filename supplied")
Catch ioProblem As System.IO.IOExc eption
'IOException error other than 'File already exists' (which
is checked above.)
MsgBox("Error - Can't process file named: " & e.FullPath)
End Try
End Select
End Sub

Function FileIsReady(ByV al sFileName As String) As Boolean
'Returns False if file is already opened by another process and the
'specified type of access is not allowed, the Open operation fails.
Dim nFileNum As Integer

nFileNum = FreeFile()
Try
FileOpen(nFileN um, sFileName, OpenMode.Binary , OpenAccess.Writ e)
FileClose(nFile Num)
Return True
Catch
Return False
End Try
End Function
Nov 21 '05 #1
2 1352
"Paul" <pr*****@privat e.com> schrieb:
As most people who use the FileSystemWatch er know, it returns lowercase
text for some strange reason. I know there's a workaround for the
lowercase the FileSystemWatch er returns by by passing the 'FullPath'
property into the constructor of a DirectoryInfo Class and reading the
'Name' property but I'm not sure how or where I'd fit that into my code.


That didn't work for me. 'Name'/'FullName' returned the same string that
was passed to the 'DirectoryInfo' 's constructor (.NET 1.1 SP1, Windows XP
Professional SP2).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
So there's no way of fixing the case? Suppose the next best thing is making
the start of each word a capital then. Pain!

Cheers,
Paul

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
"Paul" <pr*****@privat e.com> schrieb:
As most people who use the FileSystemWatch er know, it returns lowercase
text for some strange reason. I know there's a workaround for the
lowercase the FileSystemWatch er returns by by passing the 'FullPath'
property into the constructor of a DirectoryInfo Class and reading the
'Name' property but I'm not sure how or where I'd fit that into my code.


That didn't work for me. 'Name'/'FullName' returned the same string that
was passed to the 'DirectoryInfo' 's constructor (.NET 1.1 SP1, Windows XP
Professional SP2).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3332
by: Troy Murphy | last post by:
How do I prevent the FileSystemWatcher event to keep firing while the file is being created? When copying a file to the watched folder, the event fires a dozen or more times! Also, the documentation states that if more than one file is copied to the folder at the same time, a cache will queue them up for processing, but when I drop 3 files into this folder, only the 1st (sometimes the first two) cause the event to fire. Thanks, Troy
7
4123
by: Allen Anderson | last post by:
I'm trying to figure out a way to catch when a file has been written to a directory. I currently have it where I can catch when the file begins writing, but this isn't helpful as I need to know when its done. Does anyone know the right combination of flags to use to catch when the file has been written and closed? (here is my current code). // member variable FileSystemWatcher watcher = new FileSystemWatcher();
2
2232
by: Jet Leung | last post by:
Hi all, I had made a program to watching files in my directory. I had used a instance of FileSystemWatcher to do my work.And I had add some events of the FileSystemWatcher , for example onChange, onRename and so on. And I had made this program as a windows service.As I know, if I delete a file from my directory, this behavior will active this program and do something what I want to do. But after I install this program as a windows service...
13
9181
by: David | last post by:
I have been working on trying to write a directory watcher service. One of the requirments is that it be able to watch multiple directories, not sub directories of one parent directory, but just multiple directories. I have hit a snag and don't know how to get around it. Basically I read in a list of directories from the app.config and stuff them into an array, so that I have something like this: sDirsToWatch = "C:\Temp"
3
14312
by: Stampede | last post by:
Hi, I want to use the FileSystemWatcher in a Windows Service. I read an article, where the author created the FileSystemWatcher object in a seperate thread and when the event is fired, he started a working thread for processing the file, created a new FileSystemWatcher (as he said for real time processing), and then called the join method for the first thread. I can't really see the sence in this. Aren't the events of the...
20
4498
by: J-T | last post by:
We are working on an asp.net application which is a 3-tier application.I was aksed to create a component which monitors a folder and gets the file and pass them to a class library in our business logic layer(so far so good and easy).I initialize my class which is using a FileSystemWatcher in my Global.asax and everything works fine.I have found FileSystemWatcher class not very reliable and sometimes it behavies unexpectedly.I'm afriad that...
12
7462
by: ljh | last post by:
Has anyone else noticed that the FileSystemWatcher raises the changed event twice when a file is changed? Do you have any idea why this is the case?
5
24199
by: Goran Djuranovic | last post by:
Hi all, I have a file system watcher service that works fine on a local hard drive, but will not work across the network. I tried both: mapping the drive and "\\..." path both no luck. I don't receive any errors, it is just that FileSystemWatcher doesn't see any files dropped in the folder. What could be wrong? Thanks Goran
5
5607
by: =?Utf-8?B?Sm9obiBT?= | last post by:
I am trying to find out if there is a way to tell if there is already a filesystemwatcher (created by a webservice) monitoring a folder. I have a webservice that creates a filesystemwatcher, monitors a folder and then returns the contents of the new/changed files. However, if the client app loses connection to the webservice without closing the filewatcher, and then reconnects (and thus creates a new watcher), I believe I end up with...
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10214
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10164
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10001
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...
1
7540
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
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
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...
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
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.