Re: Multiple append in text files
- From: "JakeDAHS" <jskiba99@xxxxxxxxx>
- Date: 20 Jun 2006 18:05:40 -0700
I think this will work for you. You may want to consider settings
those client scripts just to write back to a central DB. That would
save a lot of trouble in the long run once you get it setup properly.
Also may want to add some error checking
All is delimited with "::"
txtFiles = place where the -hw and -sw files would be located
sInventoryPath = place to put the -inv files for the pcs
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
sInventoryPath = ".\inv\"
Set oFSO = CreateObject("Scripting.FileSystemObject")
set oFolder = oFSO.GetFolder(".\txtFiles")
For Each File in oFolder.Files
sComputer = ""
sTemp = ""
sComputer = Left(File.Name,(Len(File.Name)-Len("-hw.txt")))
wscript.echo sComputer
Set oTempFile = oFSO.OpenTextFile(File.Path,ForReading)
sTempReadAll = Replace(oTempFile.ReadAll,vbcrlf,"::")
oTempFile.Close
Set oInventory = oFSO.OpenTextFile(sInventoryPath & sComputer &
"-inv.txt",ForWriting,1)
oInventory.writeline sComputer & "::" & sTempReadAll
oInventory.Close
Next
fredriklarsso@xxxxxxxxx wrote:
Hi,
I have a script making an inventory in excel from hardwareinfo in about
150 text files
http://groups.google.com/group/microsoft.public.scripting.vbscript/browse_thread/thread/94d791ee70a717b1/0f2635c12d6347dd#0f2635c12d6347dd
At every logon there is one hardware file and one software file created
for every PC. There is no problem making some adjustment and make a new
script to get the software inventory to an excel file...but
the text files is named:
computername-hw.txt and computername-sw.txt and it's about 150 files
each.
the format in the files is the same:
pcname~user~department~.... in hw
antivirus~office version~Service packs~... in sw and so on
is it possible to get the info in the software files into the hardware
files and make the info from one computer on one line
computer1-hw.txt
computer1~john doe~accounting~...
computer1-sw.txt
symantec 10~microsoft office 2003 pro~1~...
computer2-hw.txt
computer2~anita stone~HR~...
computer2-sw.txt
Symantec 10~Microsoft office XP~4...
to
computer1-inv.txt
computer1~john doe~accounting~...symantec 10~microsoft office 2003
pro~1~...
computer2-inv.txt
computer2~anita stone~HR~...Symantec 10~Microsoft office XP~4...
so when i copy *-inv.txt inventory.txt i will have one file like this
inventory.txt
computer1~john doe~accounting~...symantec 10~microsoft office 2003
pro~1~...
computer2~anita stone~HR~...Symantec 10~Microsoft office XP~4...
Or can i get the info from the excel file software.xls into
hardware.xls? The only thing that is the same in the two excel files is
the serial number of the computers
.
- Follow-Ups:
- Re: Multiple append in text files
- From: fredriklarsso@xxxxxxxxx
- Re: Multiple append in text files
- References:
- Multiple append in text files
- From: fredriklarsso@xxxxxxxxx
- Multiple append in text files
- Prev by Date: Re: Problems in Waiting for Web page to Open
- Next by Date: Re: Problems in Waiting for Web page to Open
- Previous by thread: Multiple append in text files
- Next by thread: Re: Multiple append in text files
- Index(es):
Relevant Pages
|