Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Can anyone help me at all?

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Can anyone help me at all?
  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 >>
 Can anyone help me at all? - 4/24/2006 12:40:08 AM   
  about88

 

Posts: 2
Score: 0
Joined: 4/23/2006
Status: offline
Hey guys / Girls

Im new to these forums and have looked EVERYWHERE on the web for a solution to htis problem but am yet to find a solution!!

All i need is either VB script or Java script to do the following:

I need to move about 5000 .txt documents from a series of folders A B C D E F to one folder called main however some of the text documents in a b c d e f are the same name and require a_ to be put at the front of the name if there are mnore than 2 b_ then c_ etc etc there will be no more than 5 of the same files so going up to e_

I have found scripts and written some that will either move the entire folder or a file at a time, however the files that are the same name are being over written. If anyone can help me with a solution i would be VERY appreciative!!!!

Or maybe even point me in the right direction to getting this accomplished i am fairly new to scripting but know a little.

Thanks Again!!

Chris
 
 
Post #: 1
 
 RE: Can anyone help me at all? - 4/24/2006 1:13:20 AM   
  ebgreen


Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
Here is how I would do it:

1) Iterate through all the files in the source folder.
2) Use the .FileExists method of the FileSystemObject to determine if the file is already in the target folder
3) If it is, check for each of the variant names a-e and copy it with the first available variant name
4) If it does not, just copy it.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to about88)
 
 
Post #: 2
 
 RE: Can anyone help me at all? - 4/24/2006 8:26:24 PM   
  about88

 

Posts: 2
Score: 0
Joined: 4/23/2006
Status: offline
thanks for your help mate, just 1 question would that involve checking if all 5000 txt documents are already in the target folder?

Dim MyFile As New FileInfo("C:\\Documents and Settings\\Desktop\\statistics\\processed1\\16\\example.txt")
If MyFile.Exists() Then
'do something  
Else
'do something  
End If

Dim MyFile As New FileInfo("C:\\Documents and Settings\\Desktop\\statistics\\processed1\\16\\example1.txt")
If MyFile.Exists() Then
'do something  
Else
'do something  
End If

etc etc,

just seems like thats gonna be a hell of a lot of code repeating over 5000 to check over 5000 txt docs, can u see any way around this?

Thanks again for any help on this!

Chris

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: Can anyone help me at all? - 4/24/2006 10:55:17 PM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
Take a look at the files collection in the WSH doc.

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to about88)
 
 
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 >> Can anyone help me at all? 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