3 Replies - 1026 Views - Last Post: 22 January 2009 - 10:30 PM Rate Topic: ****- 1 Votes

#1 masipro  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 113
  • Joined: 08-July 08

copy a drive

Post icon  Posted 22 January 2009 - 03:42 AM

Hai :) Good Day,
I wish to copy all files in a specified drive; I used the below coding, but I need all the files and folders in the drive to be copied at a specified location. Please help

Option Explicit
Dim FSO As New FileSystemObject
'---------------------------
Public Sub Main()
On Error Resume Next
Dim ptold, ptnew As String
Dim n, i As Integer

ptold = "G:\Acrobat"
ptnew = "C:\Documents and Settings\Faizan\Desktop\New"
Call FSO.CopyFile(ptold, ptnew)
Call FSO.CopyFolder(ptold, ptnew, True)

End Sub




Is This A Good Question/Topic? 0
  • +

Replies To: copy a drive

#2 Nikhil_07n  Icon User is offline

  • The cheese stands alone..
  • member icon

Reputation: 49
  • View blog
  • Posts: 2,489
  • Joined: 09-January 09

Re: copy a drive

Posted 22 January 2009 - 05:27 AM

Try batch files with xcopy command and run them using shell command.
Was This Post Helpful? 0
  • +
  • -

#3 VB Crash  Icon User is offline

  • D.I.C Head

Reputation: 9
  • View blog
  • Posts: 130
  • Joined: 28-November 08

Re: copy a drive

Posted 22 January 2009 - 09:53 AM

Try with Preference=> Windows Script Host Object (it was smething like that) and make a FileSystemObject, Folder and File varible. The use the FilySistemObject to copy the files or folders. Use SET comand, something like this,it may have mistakes


dim bb as new filesysemobject
dim fol as folder

set fol=bb.getfolder("C:\windows\")




Hope this is usefful

Vace
Was This Post Helpful? 0
  • +
  • -

#4 masipro  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 113
  • Joined: 08-July 08

Re: copy a drive

Posted 22 January 2009 - 10:30 PM

View PostNikhil_07n, on 22 Jan, 2009 - 04:27 AM, said:

Try batch files with xcopy command and run them using shell command.


Thanks a lot, it is working

View PostVB Crash, on 22 Jan, 2009 - 08:53 AM, said:

Try with Preference=> Windows Script Host Object (it was smething like that) and make a FileSystemObject, Folder and File varible. The use the FilySistemObject to copy the files or folders. Use SET comand, something like this,it may have mistakes


dim bb as new filesysemobject
dim fol as folder

set fol=bb.getfolder("C:\windows\")




Hope this is usefful

Vace

:^: THANK YOU very mucb
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1