ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   FileCopy and read-only (https://www.excelbanter.com/excel-programming/294920-filecopy-read-only.html)

Dkline[_2_]

FileCopy and read-only
 
I'm using FileCopy to copy a number of files off the servers onto my C:
drive. Everything works fine except for the one file that is read-only. Any
way to persuade FileCopy to copy over that file even if it is a read-only?



Bob Phillips[_6_]

FileCopy and read-only
 
I just tested it, and it copied a read-only file just fine (as I expected).
Sure there is not some other problem in the code?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Dkline" wrote in message
...
I'm using FileCopy to copy a number of files off the servers onto my C:
drive. Everything works fine except for the one file that is read-only.

Any
way to persuade FileCopy to copy over that file even if it is a read-only?





Steve Garman

FileCopy and read-only
 
Sub test()
Dim src$, dst$
src$ = "c:\test.txt"
dst$ = "c:\test1.txt"
If GetAttr(dst$) And vbReadOnly Then
SetAttr dst$, vbNormal
End If
FileCopy src$, dst$
End Sub


Dkline wrote:
I'm using FileCopy to copy a number of files off the servers onto my C:
drive. Everything works fine except for the one file that is read-only. Any
way to persuade FileCopy to copy over that file even if it is a read-only?





All times are GMT +1. The time now is 12:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com