473,467 Members | 1,402 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

File System Object question

I have about 200 documents to which I need to write a header and a footer.
Appending (the footer) is easy, but I cannot figure out how to write to the
very beginning of the file. Any help would be appreciated
Jul 22 '05 #1
6 1333
PedroX wrote:
I have about 200 documents to which I need to write a header and a footer.
Appending (the footer) is easy, but I cannot figure out how to write to the
very beginning of the file. Any help would be appreciated


put your new text into a string1,
read in the contents of the doc to string2
string1 = string1 + string2
save string1 back to the doc.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
Jul 22 '05 #2
"PedroX" <no**@nowhere.com> wrote in message
news:RX******************@news20.bellglobal.com...
I have about 200 documents to which I need to write a header and a footer.
Appending (the footer) is easy, but I cannot figure out how to write to the very beginning of the file. Any help would be appreciated


Your "documents", I gather, are text files and not MS-Word documents.

You'll have to "rewrite" to entire text file.

Use the ReadAll method to read the intial file then write your header,
the initial file, and the footer to the same file.
Jul 22 '05 #3
Use the ReadAll method to read the intial file then write your header,
the initial file, and the footer to the same file.


Thanks 4 the replies. I guess that should work. The documents are XML files.
They are about 10 mb each. Would that be a problem?


Jul 22 '05 #4
well, thats not the greatest situation to have going on.. those are big
files
"PedroX" <no**@nowhere.com> wrote in message
news:Vu******************@news20.bellglobal.com...
Use the ReadAll method to read the intial file then write your header,
the initial file, and the footer to the same file.


Thanks 4 the replies. I guess that should work. The documents are XML
files.
They are about 10 mb each. Would that be a problem?

Jul 22 '05 #5
PedroX wrote:
Use the ReadAll method to read the intial file then write your
header, the initial file, and the footer to the same file.


Thanks 4 the replies. I guess that should work. The documents are XML
files. They are about 10 mb each. Would that be a problem?


Please don't crosspost to so many groups. This question had nothing to do
with databases (db) or components, so it was certainly off-topic in those
groups, which I've removed from this reply.

If you had mentioned from the start that you were using XML files, you would
have received a different answer. FileSystemObject is not necessary for
modifying XML . I suggest you provide a small example of what you want to
do. Are you really adding information outside of the XML? Or are you adding
nodes to the XML?

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 22 '05 #6
"McKirahan" wrote in message news:2-********************@comcast.com...
: "PedroX" <no**@nowhere.com> wrote in message
: news:RX******************@news20.bellglobal.com...
: > I have about 200 documents to which I need to write a header and a
footer.
: > Appending (the footer) is easy, but I cannot figure out how to write to
: the
: > very beginning of the file. Any help would be appreciated
:
: Your "documents", I gather, are text files and not MS-Word documents.
:
: You'll have to "rewrite" to entire text file.
:
: Use the ReadAll method to read the intial file then write your header,
: the initial file, and the footer to the same file.

If you were going to do that, wouldn't this be easier?

sub appendit(file1, file2, file3, t)
dim fso, temp, tempFile, wshShell, oExec
set fso = CreateObject("Scripting.FileSystemObject")
set wshShell = CreateObject("WScript.Shell")
if fso.FileExists(file1) then
if fso.FileExists(file2) then
if fso.FileExists(file3) then
temp = fso.GetTempName
set oExec = wshShell.Exec("%comspec% /c copy " & file1 & "+" & file2
& "+" & file3 & " " & temp)
do while oExec.status = 0
wscript.sleep 100
loop
if fso.FileExists(t) then
fso.DeleteFile(t)
end if
fso.MoveFile temp, t
end if
end if
end if
wscript.echo temp
end sub

appendit "f1.txt","f2.txt","f3.txt","f4.txt"

f4.txt would be replace with the file you wanted to end up with, however, I
wouldn't use this for XML files.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ajay Garg | last post by:
I wanted to loop through a directory and get the names of all the files in the directory and put it in a table using the file system object and VB scrip in a DTS package... How can Ido this? ...
5
by: Rick Simons | last post by:
I have multiple IIS servers, all the same version and patch level. However, a recursive file display page that works on 2 of my servers, doesn't work on the third. strPhysicalPath =...
2
by: Jack David | last post by:
Using the code below I am able to monitor a single directory for a new file and then kick-off a process to deal with the file. The question is??? How would I modify this code to be able to monitor...
0
by: Stephen Costanzo | last post by:
I am using the file system object to determine the available drive space (and total drive space) of UNC path directories, however I am also trying to strong name the DLL. While I can create the...
5
by: mbosco51 | last post by:
Hi. I have a virtual path setup in order to give my web server access to a file on my app server. I am using the file system object to check for the existance of the file and if it exists, it has...
3
by: Lise | last post by:
I am using the File System Object to create server side cookies and part of the Function that I am writing deletes a file but I am getting a permissions denied error on that line of code. I am...
1
by: Chris | last post by:
Is there any way of rollback any changes made by the file system object in the event of an error. I delete a file and copy one somewhere and the copy fails is there anyway to rollback the delete....
4
by: vdown | last post by:
Im no ASP expert but have inherited a site that scans a load of folders for PDFs using the file system object. All the PDFs are held in a time based heriarchical folder structure i.e....
3
by: vunet | last post by:
The friendly URLs in ASP is the goal of my project. However, in ASP there is no obvious page mapping as I researched compared to other languages. What I mean is making www.site.com?page=Home being...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.