Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extracting a number out of a file name and creating a new file

Status
Not open for further replies.

madhusd

IS-IT--Management
Aug 13, 2001
74
Is there a script that can do the following ?

Capture all files of a specific type in a specific folder and create a text file with the following info...

vfx -n 9724582499 -d faxmodem 1_9724582499.doc
vfx -n 9725101119 -d faxmodem 2_9725101119.doc
vfx -n 9722461109 -d faxmodem 3_9722461109.doc
vfx -n 8173451099 -d faxmodem 4_8173451099.doc
vfx -n 9726066666 -d faxmodem 5_9726066666.doc
vfx -n 9723357640 -d faxmodem 6_9723357640.doc
vfx -n 8172833175 -d faxmodem 7_8173451099.doc
vfx -n 9725424386 -d faxmodem 8_9725424386.doc
vfx -n 2142217688 -d faxmodem 9_2142217688.doc

Pay attention to the 3rd and the last columns. All files in a particular folder are in the format of 1_9724582499.doc..... etc.

I want to create a txt or csv file to extract the number from the name of the text file and put it in a seperate column and the corresponding file name in another column.

Is there a VB script or any kinda script that can do this ?
 
VBScript forum = forum329

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
Using VB script...I dunno :)

however, using VB, you could use the FSO object to get a listing of all files with the extension .doc, then parse through the list and extract what you need. then use a streamwriter object to write it to a file.
 
You can use the FileSystemObject object in VBScript, too.
 
>Using VB script...I dunno ... however, using VB, you could use the FSO object

The FSO is part of Microsoft Scripting, not of VB ... so it would be fairer to say you can use it in VBScript and also happen to be able to use it in VB

>then use a streamwriter

Stop muttering about streamwriters in the VB5/6 forum ... ;-)

 
Sorry - that should read 'a' VB5/6 forum, rather than 'the' ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top