Solved

Create ftp script from Directory Listing.

Posted on 2004-10-08
4
187 Views
Last Modified: 2012-08-13
Hi, I am need to do a script file to delete remote files via ftp:

I want to use a directory listing as the base of the text file (called script.txt)
I will shell to a batch file (called logit.bat that does this):

CD "C:\scans\"
dir /B > script.txt

Now say the result of the batch is:

BELLE-16251KTX.TIF
BELLE-16051SCO.TIF
CG-76690BSR.TIF
CG-76690BHB.TIF
OA-2700USR.TIF
OA-2710KTX.TIF

I want to amend this script.txt file to have the necessary commands to delete the files on the remote server.

the end result of the script.txt file would be :

user bco passwd pArtner5
binary
DEL BELLE-16251KTX.TIF
DEL BELLE-16051SCO.TIF
DEL CG-76690BSR.TIF
DEL CG-76690BHB.TIF
DEL OA-2700USR.TIF
DEL OA-2710KTX.TIF
bye

I can handle the rest from here.
So basically i just need to know how to add the following to the top of the file:

user bco passwd pArtner5
binary

The following infront of the already existing lines:
DEL

The following at the very end of the file.
bye



0
Comment
Question by:jerrycsakanyjr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 5

Accepted Solution

by:
naiea1231 earned 500 total points
ID: 12265878
This will do what you want, written in vbscript so just save it as a .vbs in the same directory as script.txt, it will override the contents of the original file

'open script.txt
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oTS = oFSO.OpenTextFile("script.txt")

Result = "user bco passwd pArtner5" & vbCrLf & "binary"

Do Until oTS.AtEndOfStream
Result = Result & vbCrLf & "DEL " & oTS.ReadLine

Loop

Result = Result & vbCrLf & "bye"

oTS.Close


Set oTS = oFSO.OpenTextFile("script.txt",2)

oTS.Write(Result)

oTS.Close



Let me know how it goes

James
0
 
LVL 4

Expert Comment

by:eozz_2000
ID: 12266288
You only need the file created?, or you need how to execute it via ftp in VB .NET?
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question