How to CopyFolder to a readonly Folder? Help???

  • Thread starter Thread starter Benjamin
  • Start date Start date
B

Benjamin

My problem: I'd like to transfer some custom Files for our program to work on
site,
to the local Documents and settings folder of the individual computer user,
I'd like to avoid having to program in copy each and every file to the
location and use a copy folder command of some sort in VBA.

On-line I read that the CopyFolder function can't work on a read-only folder..
and it appears that the Application data folder is readonly...

And Ideas here....


I was using code:

AppData = (Environ("AppData")) & "\Autodesk\AutoCAD 2007\R17.0\enu"

FromPath2 = "M:\SETUP_USER\ApplicationData"
ToPath2 = AppData 'my variable for

'If M:Drive Isn't Working Contact IT
If FSO.FolderExists(FromPath2) = False Then
MsgBox FromPath2 & " doesn't exist" & " Contact IT"
End If

'Copy Folder Fresh
FSO.CopyFolder FromPath2, ToPath2, False

Exit Sub

excerpt from:
http://www.devguru.com/technologies/vbscript/QuickRef/filesystemobject_copyfolder.html

The overwrite parameter is a Boolean. True allows the overwriting of
existing files in the destination, providing that the permissions on the
destination allow it ( if the destination is set as read-only, the CopyFolder
method will fail). An overwrite setting of False prevents existing files in
the destination from being overwritten.
 
User = environ("USERPROFILE")
FromPath2 = User & "\ApplicationData"

to see all the environmental parameters on your system do the following

1) go to Start button and select RUN
2) In RUN box type : cmd.exe
3) In DOS window type : SET

On VISTA
1) go to Start button
2) Search for CMD.EXE which willopen the DOS window
 
Back
Top