here you go lodis,
If anyone has a more optmized way of doin this pls lemme know.
this is very basic and I really just started developing so there might be bugs, If I find some I will update it here.
** Beware of typos **

) I am really good at makin typos
The best thing to do would be to not to copy the entire code but get the concept, that would work better! for you.
'Author: Sibasis Sahoo – march 2003
'Project: Pcanywhere 10.5 script
'Description: An Example for OLE, Visual Basic 6, Win 2000
'What it does: Connects to a host sequentially from a flat file, transfers files from host to a temporary folder, appends them into the main folder, then dials the next host from the input flat file.
'References I have set in the vb ide:
'Winawsvr
'awrem32
'Microsoft scripting runtime
'awfilexfer 1.0 type library
'awxferui 1.0 type library
' pause function its useful to set a delay so that pcanywhere does not error out
' thanks dankelt, I got this from him
Public Function Pause()
Dim PauseTime, Start, Finish, TotalTime
PauseTime = 10 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop
Finish = Timer ' Set end time.
TotalTime = Finish - Start ' Calculate total time.
'MsgBox (TotalTime)
End Function
Private Sub Form_Load()
'Declare your variables here
Dim remote As Object
Dim con, cnt As Integer
Dim Host, hostfile, remotefile, HostID As String
Dim WentOK As Boolean
Dim checktrnsfr As Boolean
Dim fso As New FileSystemObject, log As TextStream 'Create Log File
Dim todaydate, todaytime As String
Dim nFile As String
' Check if log file already exists if it dosent create it in append mode, write the header close it.
If Dir$("c:\temp\my.log"

= "" Then
'MsgBox "The file was not found. Please try again!"
Open "c:\temp\my.log" For Append As #1
Print #1, " ================================================== "
Print #1, Format$(Now, "mm-dd hh:mm:ss"

& " PCAnywhere Scripting Log File "
Print #1, " ================================================== "
Print #1, " "
Print #1, " "
Close #1
End If
'If it already exists open it in append mode
Open "c:\temp\my.log" For Append As #1
'Temporary remote folder where we transfer the files from the host into
'If it dosent exist abort the polling script write into the log file
If fso.FolderExists("s:\temporaryrecievingfolder"

= False Then
Print #1, Format$(Now, "mm-dd hh:mm:ss"

& "Error! Temp remote Folder missing ...! aborting..."
GoTo endapp:
Else
'MsgBox ("we are ok"

' for testing purposes only
End If
'Check for the existence of the input file in the polling1 folder which contains teh host names
'If it dosent exist write into log file and abort polling program
If fso.FileExists("c:\program files\symantec\pcanywhere\polling1\input.txt"

= False Then
Print #1, Format$(Now, "mm-dd hh:mm:ss"

& "Error! Input file missing ...! aborting..."
GoTo endapp:
Else
'MsgBox ("we are ok"

' for testing purposes only
End If
'If the input file exists open it in read mode
Open "c:\program files\symantec\pcanywhere\polling1\input.txt" For Input As #2
' This is where the application comes to when it wants to dial into the next host
' This happens when the app finishes gettin data from teh 1st host and is ready to get data
' from next host
nexthost:
'If files exist in the temporary remote folder delete them
If fso.FileExists("S:\temporaryrecievingfolder\*.txt"

= True Then
Kill ("S:\temporaryrecievingfolder\*.txt"

End If
'read the input file till the end of file
' if the end has been reached end application
If EOF(2) Then
Print #1, "-------------End of input file reached---------------"
GoTo endapp:
End If
' if the end hasnt been reached read the next host from the input file
' the host name will be simply "host1" or something like that in the input file
Line Input #2, Host
'MsgBox (Host) ' for testing purposes only
'Assign the host name to another variable
HostID = Host
'Set the polling folder and add the extension to the host name
'This sets the host name to c:\program files\symantec\pcanywhere\polling1\host1.chf
Host = "c:\program files\symantec\pcanywhere\polling1\" & HostID & ".chf"
'This is a check if the main folder for that host where the files are going to be transferred exists
'If it dosent exist we write to the log and dial the next host
If fso.FolderExists("s:\mainrecievingfolder\" & HostID"

= False Then
Print #1, " "
Print #1, "Error! Error! Main Remote Recieving Folder dosent exist! for " & HostID
Print #1, " "
GoTo nexthost:
End If
WentOK = True
'MsgBox (Host) ' for testing purposes only
Set remote = CreateObject("Awrem32.Application"
'Attempt to connect to the host
WentOK = remote.awConnect(Host)
'MsgBox (WentOK)
Print #1, Format$(Now, "mm-dd hh:mm:ss"

& " Connecting to host " & HostID
'Check the return boolean and branch accordingly
'If remote object not found dial next host
If WentOK = False Then
Print #1, Format$(Now, "mm-dd hh:mm:ss"

& " Couldnt find host " & HostID
Print #1, Format$(Now, "mm-dd hh:mm:ss"

& " Releasing connect thread of " & HostID
Print #1, " "
Set remote = Nothing
'MsgBox ("couldnt find host"

'WentOK = remote.awDisconnect()
GoTo nexthost:
Else
'Pause
'Check the connection status to the host
con = 0
con = remote.ConnectionStatus
'If it couldnt connect write to the log file and dial next host
If con = -1 Then
'MsgBox (con)
Print #1, Format$(Now, "mm-dd hh:mm:ss"

& " Couldnt connect to host " & HostID
Print #1, Format$(Now, "mm-dd hh:mm:ss"

& " Releasing connect thread of " & HostID
Print #1, " "
Set remote = Nothing
GoTo nexthost:
End If
'MsgBox (con)
'If it could connect start the file transfer write to log
hostfile = "c:\hostcomputer\output\*.txt"
remotefile = "s:\temporaryrecievingfolder\*.txt"
Print #1, Format$(Now, "mm-dd hh:mm:ss"

& " Connected to host " & HostID
'MsgBox ("connected"

Pause
checktrnsfr = remote.FileXferFromHost(hostfile, remotefile)
Pause
' you can check the file transfer return here I am not doing it
Print #1, Format$(Now, "mm-dd hh:mm:ss"

& " Files transferred from host " & HostID & "'s to temp poll folder."
'create another text file where we will list all the files transferred
Set log = fso.CreateTextFile("c:\temp\outputfiles.log", True)
Dim sNextFile As String
sNextFile = Dir$("s:\temporaryrecievingfolder\*.txt"
'MsgBox (sNextFile)
While sNextFile <> ""
nFile = sNextFile
log.WriteLine (nFile)
'MsgBox (sNextFile)
Dim sourcefile As String
Dim destfile As String
' set the temprary recieving folder and the main recieving folder here
' here we will try to check if files already exist in the main recieving folder
' if they exist we shall append to them otherwise we will simply copy the files
sourcefile = "s:\temporaryrecievingfolder\" & nFile
destfile = "s:\mainrecievingfolder\" & HostID & "\" & nFile
If fso.FileExists("s:\mainrecievingfolder\" & HostID & "\" & nFile) Then
Print #1, Format$(Now, "mm-dd hh:mm:ss"

& " Files found in main recieving folder append mode enabled!"
Open destfile For Append As #99
Open sourcefile For Input As #98
Dim sTemp As String
While Not EOF(98)
Line Input #98, sTemp
Print #99, sTemp
Wend
Close #98
Close #99
Else
'MsgBox ("attempting filecopy"

' copy the file from the temp recieving folder to the main recieving folder if files not found in main.
Print #1, Format$(Now, "mm-dd hh:mm:ss"

& " Files not found in main recieving folder, append mode bypassed!"
FileCopy sourcefile, destfile
End If
'set the application to read the next file in the temporary recieving folder
sNextFile = Dir$
'MsgBox (sNextFile)
Wend
' If everything successful, disconnect from this host go to the next host to be dialed
WentOK = remote.awDisconnect()
GoTo nexthost:
End If
' this is where the application comes to exit out
endapp:
'Print #1, Format$(Now, "mm-dd hh:mm:ss"

& "------- End of Script-------- "
'Print #1, " "
'Close #1
'MsgBox ("out"

Set remote = Nothing
End
End Sub