Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

File System Object - Classic ASP

Posted on 2011-03-01
2
Medium Priority
?
363 Views
Last Modified: 2012-05-11
Hi All,

I am using File System Object (FSO) to rename a file name. This is a script which I am installing on some legacy web sites. Most of the time the permissions are set correctly on the server. However, if by chance the permissions are not set to allow this then I do not want the update to happen. If there is an error I want the var BolSuccess to be set to false.

Am I doing this the right way?

Any idea?

Best regards

A.

--------------------------------------------------------------------------------------

BolSuccess = True

Set objFSO=Server.CreateObject("Scripting.FilesystemObject")
On Error resume Next

objFSO.MoveFile strPathOld, strPathNew

If Err.Number <> 0 Then            
BolSuccess = False
End If

On Error GoTo 0            
Set objFSO = nothing
0
Comment
Question by:Abiel de Groot
2 Comments
 
LVL 15

Accepted Solution

by:
pateljitu earned 2000 total points
ID: 35009766
Syntax looks correct, also to note if permission to file is not set correctly FileSystemObject will run into error and in that case Err.Number will have value greater than 0 which will allow flag BolSuccess as false.

Also if you need to trap description of error you could use

Err.Description
Err.Source
0
 
LVL 5

Author Closing Comment

by:Abiel de Groot
ID: 35087212
Thanks
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question