VB script: Unable to copy file from source to destination folder, while copying, showing 'Permission

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
I created two folders, D:VBsource & D:VBDestination, and via VB script, trying to copy the file from source to destination. I have admin rights on my machine and have win 7 OS. (Bydefault, for created folder it have Read-only attribute).
After running VB Script, It gaves me Permission Denied error on destination folder, as it has read only attribute. To remove readonly attribute, i have gone through follwing links, but it didn;twork in my case.
http://answers.microsoft.com/en-us/windows/forum/windows_7-files/how-do-i-change-the-read-only-or-system-attributes/bf537eb4-ea9e-42dc-811e-f5fb596f5945 Change read only attribute
Please help me how can i do this operation, follwing is my VB code:
<pre class="prettyprint lang-vb Option explicit
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
if fso.FileExists("D:VBsourceNew Text Document.txt") then
MsgBox "File is present"
fso.Copyfile "D:VBsourceNew Text Document.txt", "D:VBDestination"
else
MsgBox "File is not present"
End if[/code]
<br/>
<br/>

View the full article
 
Back
Top