Advertisement
Marcelooof

karina

Nov 14th, 2017
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2. Dim colFiles
  3. Dim strStartFolder
  4. Dim strDestinationfolder
  5. Dim oOldestFile
  6. Dim oFile
  7. Dim oFSO
  8. 'Const OverwriteExisting = TRUE
  9. strStartFolder = "D:\PRova"
  10. strDestinationfolder = "D:\PRova\test"  
  11. Set oFSO = CreateObject("Scripting.FileSystemObject")
  12. Set colFiles = oFSO.GetFolder(strStartFolder).Files
  13.  
  14. Do  while oFile >=0
  15.  
  16.     For Each oFile In colFiles
  17.         If Not IsObject(oOldestFile) Then
  18.             Set oOldestFile = oFile
  19.         Else
  20.             If oFile.DateLastModified < oOldestFile.DateLastModified Then
  21.                 Set oOldestFile = oFile
  22.             End If
  23.         End If
  24.     Next
  25.     oOldestFile.Move strDestinationfolder & "\" & oOldestFile.Name 'OverwriteExisting
  26.         Wscript.Sleep(3000)
  27. Loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement