Solved

File System Object - Classic ASP

Posted on 2011-03-01
2
352 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
pateljitu earned 500 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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

691 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