Name
MoveFolder (FileSystemObject Object) —
fsoObj
.MoveFolder
strSourcePath, strDestinationPath
Synopsis
Moves a folder and all its contents from one location to another.
Parameters
-
strSourcePath A string representing the path to the folder or folders you wish to move. You can include wildcard characters in the
strSourcePathargument in the last segment of the path only.-
strDestinationPath A string representing the path to which you wish to move the folders referenced in the
strSourcePathparameter. ThestrDestinationPathparameter cannot contain any wildcard characters.
Example
<%
' Dimension local variables.
Dim fsoObject ' FileSystemObject
' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
"Scripting.FileSystemObject")
' Using the MoveFolder method, move all the folders
' under C:\APPS to the D: drive.
fsoObject.MoveFolder "C:\APPS\*.*", "D:\"
. . . [additional code]
%>Notes
If you attempt to move a folder to a destination that is already a filename, you will receive an error. If the destination you provide represents the name of a preexisting folder, you will receive an error unless the source argument ends with a wildcard or a backslash (\). In this case, the source folder (or folders) and all its contents will be moved to the destination folder. For example, the following code results in an error:
<% ' Assume FileSystemObject object is instantiated 'already. Also assume that D:\ apps already exists. fsoObject.MoveFolder "C:\apps", "d:\apps" ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access