[AccessD] Move Folder

Jurgen Welz jwelz at hotmail.com
Mon Apr 26 18:37:33 CDT 2010


You can run Robocopy from an Access form:

 

            ShellWait "Robocopy.exe """ & strSourcePath & """ \\Gracsrv\GOMFiles\Estimates\" & r(1) & _ " /E /V /log+:\\Gracsrv\GOMFiles\Robocopy.log"

The above was part of a data migration routine I wrote a while back.  There was a discussion about ShellWait a couple or 3 months back.  In the excerpted line above, r(1) was the 2nd field in a recordset that was being iterated as strSourcePath was changed in the code loop as well.  The optional switches for Robocopy are numerous and in this case include appending the results in a log file.

 

There are recursive folder move routines that work as well and I've written more than a fiew based on the Access Developer Handbook, but there is another quite easy approach:

 

Name  "Z:\Launch\Test" as "S:\dash\Taste"

 

will move all the files below the folder named Test.   I use this to move files a fair bit.  It moves the files and sub folders nicely.  It will not create the dash folder but it will create the Taste folder and move everything that was in Test to the new Taste folder so you may need to create the path with MkDir building out from the root, but once you've got the base path, it creates all the sub folders.

 


Ciao Jürgen Welz

Edmonton, Alberta

jwelz at hotmail.com

 
> From: rockysmolin at bchacc.com
> To: accessd at databaseadvisors.com
> Date: Mon, 26 Apr 2010 16:16:15 -0700
> Subject: Re: [AccessD] Move Folder
> 
> That looks like it'll do the job - unless he wants it in an Access form
> prompting for source and target locations. 
> 
> Rocky
> 
> 
> -----Original Message-----
> Sent: Monday, April 26, 2010 3:48 PM
> Subject: Re: [AccessD] Move Folder
> 
> Robocopy..... command line utility.
> 
> Drew
> 
> -----Original Message-----
> 
> Dear List:
> 
> What is the best way (through code, of course) to move a folder and all of
> its subfolders and files to a new location?
> 
> 
> 
> MTIA
> 
> 
> 
> Rocky Smolin
> 

 		 	   		  
_________________________________________________________________
Videos that have everyone talking! Now also in HD!
http://go.microsoft.com/?linkid=9724465


More information about the AccessD mailing list