Hi,

I'm trying to automate some repetative tasks using a set of simple scripts.
I have a handful of file lists for files that are in a directory structure
and in order to upload the files via ftp, i need to prepend the filelist
with some text i.e. 'put directory\' for each line in the text file. Not
being used to using vbscript I need to know how *exactly* to accomplish this
in vbscript (since I can't get any where close using DOS commands).

Thanks

J

Re: Prepend a list of filenames with a string by Tom

Tom
Tue Jul 11 08:11:45 CDT 2006

Maybe something like this will do ...

' warning - aircode
dim sPathSpecIn, sPathSpecOut, aTmp
sPathSpecIn = "c:\somewhere\somefile.txt"
sPathSpecOut = "c:\somewhere\someotherfile.txt"
with createobject("scripting.filesystemobject")
aTmp = split(.opentextfile(sPathSpecIn, 1).readall, vbNewline)
aTmp(0) = "put directory\" & aTmp(0)
.opentextfile(sPathSpecOut, 2, true).write join(aTmp, vbNewline _
& "put directory\")
end with

BTW, this CAN be done with the command processor using the /F switch
with the FOR command, since it can read and write files line by line.
Type FOR/? at a command prompt for help or look for 'MS DOS commands'
in the Windows help (F1 key on the desktop).

Tom Lavedas
=============
http://members.cox.net/tglbatch/wsh

J wrote:
> Hi,
>
> I'm trying to automate some repetative tasks using a set of simple scripts.
> I have a handful of file lists for files that are in a directory structure
> and in order to upload the files via ftp, i need to prepend the filelist
> with some text i.e. 'put directory\' for each line in the text file. Not
> being used to using vbscript I need to know how *exactly* to accomplish this
> in vbscript (since I can't get any where close using DOS commands).
>
> Thanks
>
> J