Using the FSO inorder to create a FTP

Results 1 to 2 of 2

Thread: Using the FSO inorder to create a FTP

  1. #1
    Join Date
    Dec 1969

    Default Using the FSO inorder to create a FTP

    ... File so that I can then run this file in a command prompt.<BR><BR>I have a piece of script that doesn&#039;t seem to work. The objective was to create a txt file that would query my db so that I could then run this text file in the command prompt. Here is the script but nothing gets created.<BR><BR>&#060;% <BR> Function Main()<BR> On Error Resume Next<BR><BR> Dim strDestPath, strSourcePath<BR> Dim fso<BR> Dim objTxtFile<BR><BR> &#039; Initialize the variables<BR> strSourcePath = "Q:SharedGRIPAWebDevelopmentGRIPAWEBimagesPDF" <BR> strDestPath = "Q:SharedGRIPAWebDevelopmentGRIPAWEBimagesPDF"<BR> <BR> Set fso = CreateObject("Scripting.FileSystemObject")<BR><BR> &#039; Create the Text File<BR> Set objTxtFile = fso.CreateTextFile( strDestPath & "ftpSend.txt", TRUE)<BR><BR> &#039; Write the Header<BR> objTxtFile.writeline( "open" )<BR> objTxtFile.writeline( "kbrady" )<BR> objTxtFile.writeline( "gripa3592" )<BR> objTxtFile.writeline( "cd images" )<BR> objTxtFile.writeline( "cd pdf" )<BR> <BR> dim conn <BR> <BR> Set conn = createobject("adodb.connection")<BR> &#039; Set rsFName = Server.CreateObject("adodb.Recordset") <BR> "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=gripaWeb_writer;Password=writer;Initial Catalog=GRIPANET;Data Source=HUMBOLDT75"<BR> <BR> SQL = " SELECT FileName" _ <BR> & " FROM dbo.Alerts" _ <BR> & " WHERE (Month(InsDate) = Month(GetDate()) AND Day(InsDate) = Day(GetDate()))" _<BR> & " OR " _<BR> & " (Month(UpdateDate) = Month(GetDate()) AND Day(UpdateDate) = Day(GetDate()))"<BR><BR> Set rsFName = conn.execute(SQL)<BR> <BR> Do While Not rsFName.EOF<BR><BR> objTxtFile.writeline( "put """ & strSourcePath & "\" & rsFName("FileName") & "")<BR><BR> rsFName.MoveNext <BR> Loop <BR><BR> objTxtFile.writeline( "quit" )<BR> objTxtFile.Close<BR><BR><BR> &#039; CLEAN UP<BR> Set objTxtFile = Nothing<BR> Set fso = Nothing<BR><BR> conn.close <BR> set conn = nothing<BR> <BR> End Function<BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default The code is OK

    but you have made this as a Function is it being called OK by the rest of your app? <BR>Copy/Paste just the code you have reproduced here into a new asp file and remove the <BR>Function Main()<BR>End Function<BR>lines, then run it.<BR>What about permissions on the folder?<BR>"Q:SharedGRIPAWebDevelopmentGRIPAWEBima gesPDF"<BR><BR>Try a local dir if your not sure.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts