Copy a directory
Jason,
My interpretation is that you want a copy of the folder installed in
the same directory with a new name.
'-------------------------------
Sub CopyFolder()
'Jim Cone - San Francisco, USA
'Requires a project reference to the "Microsoft Scripting Runtime" library.
'Copies folder, renames it and installs it in same directory.
Dim objFSO As Scripting.FileSystemObject
Dim objFolder As Scripting.Folder
Set objFSO = New Scripting.FileSystemObject
'copy folder to the temp file.
objFSO.CopyFolder "C:\orig", "C:\WINDOWS\Temp\"
'rename the copied folder.
Set objFolder = objFSO.GetFolder("C:\WINDOWS\Temp\orig")
objFolder.Name = "dest"
'move the copied folder back to the original directory.
objFSO.MoveFolder objFolder, "C:\"
Set objFolder = Nothing
Set objFSO = Nothing
End Sub
'-------------------------------
wrote in message
...
How would I copy a directory(this does have things in it if that
matters), for the sake of this example "C:\orig" to a new location
"C:\dest" The code I have written keeps giving me an error.
dim origdir as string
dim destdir as string
origdir = "C:\orig"
destdir = "C:\dest"
filecopy origdir, destdir
I have also tired ending the dir strings with backslashes and that
doesn't seem to work either.
Thanks in advance for any help,
Jason Self--
|