[AccessD] Move Folder

Rocky Smolin rockysmolin at bchacc.com
Mon Apr 26 19:10:29 CDT 2010


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

That looks like the most efficient way.  He wants a module that accepts the
source folder and target paths.  So using your example I would call my
module MoveIt("Z:\Launch\Test", "S:\dash\Taste") which would have just this:

Public Sub MoveIt(argSource, argTarget)

	Name argSource & " as " & argTarget
	MsgBox "Folder Moved"

End sub

But is Name a key word that does this moving?  I've never seen it in VBA
like that.

TIA

Rocky


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jurgen Welz
Sent: Monday, April 26, 2010 4:38 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Move Folder


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
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list