Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
slugfest
Starting Member
18 Posts |
Posted - 2004-10-29 : 11:36:47
|
| I'm trying to use an ActiveX script to sort a number of files into a set of directories based on two characters (digits) of the file name. I can get them to sort fine if the script doesn't run across a file that already exists. So I tried adding a deleteFile to delete the existing file and then move the new file into that directory, but it keeps failing. Any advice is appreciated. Here's the script...Function Main()dir= "C:\_image_drop"Set Fso = CreateObject("Scripting.FileSystemObject")Set objFolder = Fso.GetFolder("C:\_image_drop")Set colFiles = objFolder.FilesIf colFiles.Count > 0 ThenFor each objFile in colFilesIf UCase(Right(objFile, 4)) = ".JPG" thenn_dir = Left(Right(objFile, 8), 2)If Fso.FileExists(dir&"\"&n_dir&"\"&objFile) ThenFso.DeleteFile(dir&"\"&n_dir&"\"&objFile)End IfobjFile.Move(dir&"\"&n_dir&"\")End IfNextEnd IfMain = DTSTaskExecResult_SuccessEnd Function |
|
|
|
|
|