|
-
Sep 28th, 2000, 11:45 AM
#1
Thread Starter
Fanatic Member
I have tried using the FileSystemObject to move a folder that contains text files and up to 3 levels of sub-folders, but with no luck. I need to move the folder and everything in it from one server to another.
Does anyone have a working example of doing this ?
Or is there a better way ?
Thanks.
-
Sep 28th, 2000, 12:03 PM
#2
You should be able to use the MoveFolder Method of the FileSystemObject, but in some cases it make give you a Permission Denied Error when moving to another volume (or server), if this is the case use a 2 pass process, i.e
Code:
Private Sub Command1_Click()
Dim oFSO As Object
Set oFSO = CreateObject("Scripting.FileSystemObject")
Call oFSO.CopyFolder("C:\Test", "D:\Test")
Call oFSO.DeleteFolder("C:\Test", True)
Set oFSO = Nothing
End Sub
-
Sep 28th, 2000, 12:11 PM
#3
Thread Starter
Fanatic Member
Thanks Aaron.
That was exactly what was happening, and your solution works great. You saved me several more hours of frustration.
-
Jan 10th, 2007, 11:15 AM
#4
Addicted Member
Re: Moving folders and sub-folders ?
is copying slower than moving??
p.s. sorry to bring an old thread... but it's better to use this one rather than create a new one ...isn't it?
-
Jan 10th, 2007, 11:45 AM
#5
Re: Moving folders and sub-folders ?
 Originally Posted by lplover2k
is copying slower than moving??
p.s. sorry to bring an old thread... but it's better to use this one rather than create a new one ...isn't it?
Moving is copying, then going back and deleting.
-
Jan 10th, 2007, 11:50 AM
#6
Re: Moving folders and sub-folders ?
i was under the impression that moving just changes where the file is indexed in the filesystem - no actual data is moved, and it's certainly not copied and killed (unless it's across drives, I guess) - thus Moving is faster than Copying
-
Jan 10th, 2007, 11:53 AM
#7
Re: Moving folders and sub-folders ?
 Originally Posted by bushmobile
i was under the impression that moving just changes where the file is indexed in the filesystem - no actual data is moved, and it's certainly not copied and killed (unless it's across drives, I guess) - thus Moving is faster than Copying
From an OS standpoint you are correct.
However, programmatically, from VB, you would have to use "FileCopy" and then "Kill" to perform a "Move"
-
Jan 10th, 2007, 11:54 AM
#8
Re: Moving folders and sub-folders ?
 Originally Posted by Hack
From an OS standpoint you are correct.
However, programmatically, from VB, you would have to use "FileCopy" and then "Kill" to perform a "Move"
VB Code:
Name "C:\blah.txt" As "C:\text\blah.txt"
-
Jan 10th, 2007, 12:01 PM
#9
Re: Moving folders and sub-folders ?
 Originally Posted by bushmobile
VB Code:
Name "C:\blah.txt" As "C:\text\blah.txt"
Good point....for some reason my aged brain never associated this type of code with anything but file renaming.
I think I'll go home and take a nap.
-
Jan 10th, 2007, 02:34 PM
#10
Re: Moving folders and sub-folders ?
 Originally Posted by lplover2k
is copying slower than moving??
p.s. sorry to bring an old thread... but it's better to use this one rather than create a new one ...isn't it?
Actually, it would be best to create a new thread and post a link to the thread you are referencing.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 10th, 2007, 02:48 PM
#11
Addicted Member
Re: Moving folders and sub-folders ?
oh ok... will do that next time... why is bringing old threads bad...???
-
Jan 10th, 2007, 02:51 PM
#12
Re: Moving folders and sub-folders ?
Well without going too far off topic, because it also sends out notifications to ever member that is subscribed to the thread for one. Another would be that in a way its thread hijacking - taking over someone else's thread topic. . And still, members will see the initial question and have to be bothered with reading the entire thread to find that it was solved and some addition/off topic question was asked when it would save them time to just have a new thread and read a single post.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 10th, 2007, 03:31 PM
#13
Re: Moving folders and sub-folders ?
another reason: if you jump on a RESOLVED thread, then most people aren't going to bother looking at it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|