各位大哥能不能举个在asp中用filesystem.object拷贝一个目录到另一个目录的程序?(100分)

  • 主题发起人 主题发起人 飞云.net
  • 开始时间 开始时间

飞云.net

Unregistered / Unconfirmed
GUEST, unregistred user!
我的问题很难吗?怎么没人回答?
 
Set fsobj = CreateObject("Scripting.FileSystemObject")
fsobj.CopyFolder "f:/temp","F:/2/"
拷贝F的temp目录到F:/2目录下。
 
看看下面的例子吧:
[JScript]
var fso, f;
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.CreateTextFile("c://testfile.txt", true);
f.WriteLine("This is a test.");
f.Close();
f = fso.GetFile("c://testfile.txt");
f.Copy("c://windows//desktop//test2.txt");

[VBScript]
Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile("c:/testfile.txt", True)
MyFile.WriteLine("This is a test.")
MyFile.Close
Set MyFile = fso.GetFile("c:/testfile.txt")
MyFile.Copy ("c:/windows/desktop/test2.txt")
 
我这列出一些方法,详细的请看MSDN,还有例子:
Copy Method
Copies a specified file or folder from one location to another.
CopyFile Method
Copies one or more files from one location to another.
CopyFolder Method
Recursively copies a folder from one location to another.
CreateFolder Method
Creates a folder.
CreateTextFile Method
Creates a specified file name and returns a TextStream object that can be used to read from or write to the file.
Delete Method
Deletes a specified file or folder.
DeleteFile Method
Deletes a specified file.
DeleteFolder Method
Deletes a specified folder and its contents.
DrivesExists Method
Returns true if the specified drive exists
false if it does not.
Exists Method
Returns true if a specified key exists in the Dictionary object, false if it does not.
FileExists Method
Returns true if a specified file exists
false if it does not.
FolderExists Method
Returns true if a specified folder exists
false if it does not.
 
上面的方法我试过了,不行!出现500错误!
 
我试过的,可以用啊,我用的是win2000
 
多人接受答案了。
 
后退
顶部