如何使用asp将现有文件移动到另一个文件夹,但我只发送文件系列“scn_1”
FROM -- > d:\image\scn_1_1.jpg , d:]image\scn_1_2.jpg
TO --> d:\image2\backup\scn_1_1.jpg, scn_1_2.jpg
在asp或vb中
这是我的示例代码
Dim fs
fs = Server.CreateObject("Scripting.FileSystemObject")
Dim scanpath = Request.QueryString("spath")
Dim rkpath = Request.QueryString("rkpath")
Dim series = Request.QueryString("series")
fs.MoveFile("D:\Ethiraj\ScanDcocument\scanimage\test.txt", "D:\Ethiraj\ScanDcocument\Rk_Images\test.txt")
fs = Nothing
答案 0 :(得分:0)
Dim fs fs = Server.CreateObject(“Scripting.FileSystemObject”)Dim scanpath = Request.QueryString(“virtu_dir”)Dim rkpath = Request.QueryString(“RK_path”)Dim series = Request.QueryString(“series”) Dim fileToFind = series& “* .jpg”Dim dirs As String()= IO.Directory.GetFiles(scanpath,fileToFind)Dim dir As String for Each dir in dirs if dir.Contains(series)Then Dim filename = System.IO.Path.GetFileName( dir)fs.CopyFile(dir,rkpath +“\”+ filename)fs = Nothing End If Next