I have a folder with about 600,000 text files in it, windows having a lot of problem just opening this folder.
I needed to analyze some of the text files, so I wanted to organize it by months.
I made a very simple vbscript to move a file to a folder based on the creation date.
for testing, I limited the loop to the first 10 files.
The script completed its run, no errors, but it doesn't do anything.
no files were moved, no folders were created, no log files were created.
tested on other folders with small amount of text files, script worked fine.
Is there any limitation preventing me from working with a folder of this magnitude?
Set myFSO = WScript.CreateObject("Scripting.FileSystemObject")
Set fil = myFSO.GetFile(Wscript.ScriptFullName)
Set txtdir = fil.ParentFolder
Set log = myFSO.CreateTextFile("log.txt")
for each file in txtdir.files
dim fileDate, fileMonth, fileYear, newpath
fileDate = CDATE(file.DateLastModified)
fileMonth = monthname(month(fileDate),true)
fileYear = Year(fileDate)
newpath = fileMonth & fileYear & "\"
if not myfso.folderexists(newpath) then
log.writeline("moving " & file.name & " to " & newpath)
myFSO.movefile file.path, newpath
I redirected my output and my log to a different folder and it works.
Permission is the same on both folders.