November 9, 2000 - Moving Files
November 9, 2000 Moving Files Tips: October 2000
Yehuda Shiran, Ph.D.
|
move()
method of the File
object. Its syntax is the following:
fileObj.move(destination)
where destination
is where you want the file to be moved to.
Here is a piece of script that will move a file from drive c to drive d:
<SCRIPT LANGUAGE="JavaScript">
<!--
myActiveXObject = new ActiveXObject("Scripting.FileSystemObject");
file = myActiveXObject.GetFile("c:\\test.txt");
file.copy("d:\\", true);
// -->
</SCRIPT>
Notice that you don't have to specify a new name for the moved file, but just the new folder where to move it to. The file will keep its original name.