![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | DateLastModified The following script is a small piece of a larger script. I am trying to move all text files that begin with "BA" and are older than today to a different folder. The script does not give me any erros. The issue is that is still moves all the files that begin with "BA" regardless of the date modified. 3 files named: BA20090815.txt BA20090816.txt BA20090817.txt Only files BA20090815.txt and BA20090816.txt should be moved but all 3 files are being moved. If I put in the code wsh.echo objFile.DateLastModified the correct 2 files appear. Here is the code: Set fso = CreateObject("Scripting.FileSystemObject") Set objfolder = fso.getfolder("c:\document\BLMed") For Each objFile in objFolder.Files If Left(objFile.Name, 2) = "BA" Then If DateDiff("d", objFile.DateLastModified, Now) > 1 Then fso.MoveFile "c:\document\BLMed\BA*.txt", "c:\document\BLMed\Logs\" 'wsh.echo objFile.DateLastModified End If End If Next I do not want to use a bat or cmd file or robocopy because this is a small piece of a bigger script. The rest of the script works except this one piece. Thanks! |
My System Specs![]() |
| | #2 (permalink) |
| | Re: DateLastModified See the post that New Anon crossposted for you. "Anonymous" <Anonymous@xxxxxx> wrote in message news:820E484E-A752-4ECF-8B1F-8D27F1B6782B@xxxxxx |
My System Specs![]() |
![]() |
| Thread Tools | |
| |