473,396 Members | 1,933 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,396 software developers and data experts.

Scripted file search fails - security issue?

Hi, the script below worked until a few weeks ago. The only change
that we know of were security changes such as deleting an administrator
account under which the file was originally created. Does anyone know
if security issues would make this script below fail and/or how this
could be resolved? Thanks.
SourceDir = "G:\test"
With Application.FileSearch
.NewSearch
.LookIn = SourceDir
.SearchSubFolders = False
.Filename = ".txt" ' also tried "*.txt"
If .Execute() > 0 Then ' returns false even though
files exist in G:\test
MsgBox "Success??"
Else
MsgBox "Execute() failed"
End If
End With

Dave

Mar 22 '06 #1
5 1591
You left out a backslash in

SourceDir = "G:\test"

This would look for a file called G:\testFile1.txt

where what you really want is G:\test\File1.txt

Change SourceDir to

SourceDir = "G:\test\"

All I did was append a "\" backslash to SourceDir

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Mar 22 '06 #2
Ok, I originally had the slash and tried it without for testing, so
even though I added it again, it still doesn't work in my environment.

The reason I suspect a security issues is that this happened before
with an InfoPath form I created. We have Office 2003 with InfoPath,
which does not allow VB Scripts to be run without either a certificate
or if it was created by a user with administrative privledges. I was
wondering if Access 2003 may have also inherited this added security.
Also, the exact same Access form works on another server that has
Access 2002.

Mar 22 '06 #3
I tried your script out in MS Access 2003. It worked fine for me. Here
is what I tried:
Sub fileSrch()
Dim SourceDir As String, i As Integer

SourceDir = "C:\Code\"
With Application.FileSearch
.NewSearch
.LookIn = SourceDir
.SearchSubFolders = True
'.filename = ".txt"
.FileType = msoFileTypeDatabases '-returns mdb's & ADPs
If .Execute() > 0 Then
Debug.Print "Success"
For i = 1 To .FoundFiles.Count
Debug.Print .FoundFiles(i)
Next
Else
Debug.Print "Execute did not find anything"
End If
End With

End Sub

I am not up on security issues, otherwise.
Rich

*** Sent via Developersdex http://www.developersdex.com ***
Mar 22 '06 #4
I think I need to look at my setup. Due to new policies here my
security level is very low on this machine. On it your script stops on
this line,

..FileType = msoFileTypeDatabases '-returns mdb's & ADPs

....without even an error message.

Do you know if there is a way to turn error message on? Anyway, thanks
for your effort, and I'll let you know once I figure this out.

Mar 22 '06 #5
It probably won't help you feel any better, but I hate it when that
happens - when stuff doesn't work consistently across all workstations.

For me, about 99% of the code that I try out from this NG that works on
someone else's workstation/server will work on my workstations and
servers. I use winxp on the workstations and Server2003 for the
servers. If you are on a similar OS then I deduce that it may be a
configuration issue or maybe you need to run windows update or maybe
need a newer service pack on your machines.

Actually, now that I think about it, I have had some issues using mso
Constants. I was actually kind of surprised that .FileType =
msoFileTypeDatabases returned a list of mdb/adp's from my folder.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Mar 22 '06 #6

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

Similar topics

6
by: Mike | last post by:
Any help would be greatly appreciated. Based on MS KB article Q248187 (HOWTO: Impersonate a User from Active Server Pages), I developed an ActiveX DLL (using VB6.0 Enterprise SP5), and deployed...
0
by: Jason Smirnow | last post by:
I posted this to the SQL Server group but got no good responses, so I'm trying here... I have a DTS package I am kickig off from a C#.Net applcation that imports a tab delimited text file...
11
by: sur | last post by:
Hello, My problem is that File.Exists works fine if my file is on my local drive but returns false if its on any other drive. I think that the issue is probably file permissions and so I have...
6
by: Chad Crowder | last post by:
Getting the following error on my production server whether the file exists or not: "System.IO.IOException: Cannot create a file when that file already exists." Here's the code generating the...
2
by: John Regan | last post by:
Hello All I am trying to find the owner of a file or folder on our network (Windows 2000 Server) using VB.Net and/or API. so I can search for Folders that don't follow our company's specified...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
7
by: sprash | last post by:
Newbie question: I'm trying to determine if a file physically exists regardless of the permissions on it Using File.Exists() returns false if it physically exists but the process does not...
7
by: gregp1 | last post by:
Hi guys, Here's the code I'm to refer to: <html> <body> .... <form method="get" action="http://www.google.com/search" name="google" />
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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,...

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.