sverkot Posted June 26, 2007 Share Posted June 26, 2007 Hi,I have written a vbscript program to move files that are older than 30 days from a folder and its subfolders to another folder (without keeping the directory structure). However, if a file has the same name as one in its subfolders, it exits saying "File already exists". (Since a folder cannot have two files of the same name ) My question is, is there a way to move files and overwrite if it already exists? Or is there any other work around? For Each objFile in colFiles fileModifyDate =objFile.DateLastModified daysSinceModify = datediff("d", fileModifyDate, date) 'Move file only if it is older than modify date specified If daysSinceModify > 30 and objFSO.FileExists(objFile) Then objFSO.MoveFile objFile, objDestFolder End If message = objFile.path & " ," & objFile.name & " ," & fileModifyDate writeLog logFile, message objFSO.MoveFile objFile, objDestFolder End If Next Link to comment Share on other sites More sharing options...
This topic is now archived and is closed to further replies.