Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


When moving files my code quits after the 55th fil

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,3104
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> When moving files my code quits after the 55th fil
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 When moving files my code quits after the 55th fil - 5/24/2005 8:30:26 AM   
  dishmj

 

Posts: 2
Score: 0
Joined: 5/24/2005
From:
Status: offline
When moving files from one folder to another using the code below, I find that the filecoll quits after 55 files. I have over one hundred files to move and I find myself running this srcipt more than once to move all the files. If anyone can see anything wrong please let me know.

Option Explicit

'---------------------------------------
'Moves Excel documents to archive folder
'---------------------------------------

MsgBox ("Start")
Dim fso, file, folderobj, filecoll
Dim ProgArgs, inputFile, outputFile
Dim i

Set fso = CreateObject("Scripting.FileSystemObject")
Set folderobj = fso.GetFolder("q:\common\statements\")
Set filecoll = folderobj.Files

For Each inputfile in filecoll
If Mid(inputfile, 22, 5) = "excel" Then
Set file = fso.OpenTextFile(inputFile, 1)
fso.MoveFile "q:\common\statements\" & inputFile.name, ("q:\common\statements\xls\")
End If
Next
Set fso=nothing
Set folderobj=nothing
Set filecoll=nothing
MsgBox ("FINISHED")
 
 
Post #: 1
 
 Re: When moving files my code quits after the 55th fil - 5/25/2005 12:41:38 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
Why do you open the file before you move it? This is not needed, comment this out and then try it. Also, are all the files the same case? You may want to make this a case insensitive compare.

Mid(lcase(inputfile.name),22,5)

Also, on your move line you could change
"q:\common\statements\" & inputFile.name to inputfile.path

(in reply to dishmj)
 
 
Post #: 2
 
 Re: When moving files my code quits after the 55th fil - 5/25/2005 2:50:24 AM   
  dishmj

 

Posts: 2
Score: 0
Joined: 5/24/2005
From:
Status: offline
Mike, thanks for your input. I have tried your suggestions, but with no luck. I took out the open since that was from some old code that I had copied from. The files were all the same case. I also changed to inputfile.path just to shorten the code. However, I did create a work around by counting the files dividing by 55 adding one to that count and looping through my code until greater than that count. Thanks for your help.

(in reply to dishmj)
 
 
Post #: 3
 
 Re: When moving files my code quits after the 55th fil - 5/25/2005 5:58:15 AM   
  didorno

 

Posts: 361
Score: 0
Joined: 2/12/2005
From:
Status: offline
dishmj, I think that you can get your results easier.

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFile "q:\common\statements\*.exel", "q:\common\statements\xls\"

Maybe your "55 problem" is then gone.
Regards.

< Message edited by didorno -- 7/20/2005 7:03:52 AM >

(in reply to dishmj)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> When moving files my code quits after the 55th fil Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts