Javascript FileSystemObject (FSO) MoveFolder method also provides the functionality similar to cut and paste function of windows. FSO MoveFolder method moves the specified source folder from one place to other specified location at client’s PC. MoveFolder method supports wild card characters that allow you to move multiple folders based on the filter or search string generated by the wild card characters in the source path. Destination path of FSO MoveFolder method does not support wild card characters.
Syntax for Javascript FSO MoveFolder Method
fso.MoveFolder(source, destination);
FSO MoveFolder method accepts two parameters as follows:
1. source: path of the source folder or folders to be moved to other location. Wild card characters allow you to move multiple folders to other location.
2. destination: path of the destination folder where source folder or folders to be moved. This parameter does not support wild card characters.
Note: destination path must end with directory separation symbol i.e. “\”
Example of Javascript FSO MoveFolder Method
<script type="text/javascript">
// initialize ActiveXObject and create an object of Scripting.FileSystemObject.
var fso = new ActiveXObject("Scripting.FileSystemObject");
fso.MoveFolder("C:\\Temp\\folder1", "C:\\Temp\\folder2\\");
fso = null;
</script>
Continue to next tutorial: Javascript FSO OpenTextFile Method to learn how to open a file using text stream.