Solved

ftp command line

Posted on 2001-07-25
12
207 Views
Last Modified: 2010-04-13
I want to create a batch file - which will transfer a directory to another machine using ftp command.

cud anybody help me

0
Comment
Question by:arvind
  • 7
  • 5
12 Comments
 
LVL 2

Expert Comment

by:DanielBlais
ID: 6317681
Do you know the content of the directory, or the content is it subject to change?
0
 
LVL 5

Author Comment

by:arvind
ID: 6317690
no - sql store procedure will create random sub-dir in that directory.
0
 
LVL 2

Expert Comment

by:DanielBlais
ID: 6317752
And can your application create a txt file somewhere?
0
 
LVL 5

Author Comment

by:arvind
ID: 6317769
Hi  DanielBlais ,

Basic need are following

machine1 -- c:\partner
--part1
--part2
--wdjjkd
--1289613

machine2 --c:\partner

So I like to copy partner direcorty to machine2 with all the contains.

0
 
LVL 2

Expert Comment

by:DanielBlais
ID: 6317807
You'll need an application that recurse the directory and write an txt files which contain the ftp command.
0
 
LVL 5

Author Comment

by:arvind
ID: 6317844
Hi  DanielBlais ,

Basic need are following

machine1 -- c:\partner
--part1
--part2
--wdjjkd
--1289613

machine2 --c:\partner

So I like to copy partner direcorty to machine2 with all the contains.

0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 5

Author Comment

by:arvind
ID: 6317847
could pls give the script or application
0
 
LVL 2

Accepted Solution

by:
DanielBlais earned 200 total points
ID: 6317988
Here the vb application that generate the batch files.

Run UPLOAD.BAT

Change the parameter for your settings.

You may need to change a bit as per your need.

Option Explicit
Dim sFich() As String
Dim iNbFich As Long
Dim iNbDir As Long
Const servername = "1.1.1.1"
Const username = "username"
Const password = "password"

Private Sub main()
searchFile "d:\projets"
Dim i As Long

Open "c:\ftpup\upload.bat" For Output As #1
For i = 1 To iNbDir
Print #1, "call ftp" & i & ".bat"
Next i
Close #1

End Sub


Public Sub searchFile(sHomeDir As String)
Dim sTempFich As String

Dim iNbRep As Integer         ' Le nombre de repertoire dans le repertoire courrant
Dim sRep() As String          ' Le array des repertoires dans le rep courrant
Dim i As Integer

' Stock (variable globale) les fichiers trouves dans le rep courrant
sTempFich = Dir(sHomeDir + "\*.*")
iNbDir = iNbDir + 1

Open "c:\ftpup\ftp" & CStr(iNbDir) & ".bat" For Output As #1
Print #1, Left(sHomeDir, 2)
Print #1, "cd" & Right(sHomeDir, Len(sHomeDir) - 2)
Print #1, "ftp " & servername & " -s:c:\ftpup\dir" & iNbDir
Close #1

Open "c:\ftpup\dir" & CStr(iNbDir) For Output As #1

Print #1, username
Print #1, password
Print #1, "other ftp command ... "
Print #1, "cd" & Right(sHomeDir, Len(sHomeDir) - 2)

While sTempFich <> ""
    If sTempFich <> "." And sTempFich <> ".." Then
        If GetAttr(sHomeDir + "\" + sTempFich) <> vbDirectory Then
            Print #1, "put " & sTempFich
        End If
    End If

    sTempFich = Dir
Wend

Close #1

' stock (variable locale) tous les repertoires dans le rep courant
sTempFich = Dir(sHomeDir + "\*.*", vbDirectory)
While sTempFich <> ""
    If sTempFich <> "." And sTempFich <> ".." Then
        If GetAttr(sHomeDir + "\" + sTempFich) = vbDirectory Then
            iNbRep = iNbRep + 1
            ReDim Preserve sRep(iNbRep - 1)
            sRep(iNbRep - 1) = sHomeDir + "\" + sTempFich
        End If
    End If
 
    sTempFich = Dir
Wend

' cherche dans tous les repertoires trouves
For i = 0 To iNbRep - 1
    searchFile sRep(i)
Next i
End Sub


0
 
LVL 5

Author Comment

by:arvind
ID: 6318042
could pls give the script or application
0
 
LVL 2

Expert Comment

by:DanielBlais
ID: 6318053
Don't make an refresh after posting an comment, il make your comment post twice!
0
 
LVL 5

Author Comment

by:arvind
ID: 6318091
could pls give the script or application
0
 
LVL 5

Author Comment

by:arvind
ID: 6350433
Thanks - I'd made some mdoification in ur script - Its now working fine. But Whenever new folder comed we need to run script agagin.

And this script does not create folder - this means 1st time I'd copy folder manualy
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Remote Access to a Windows 2000 Computer 2 498
Sapphire RAGE 128 Pro 32M - Windows 2000 Driver 2 929
Making a spare domain pc 12 323
P2V conversion for Windows NT 4.0 Server 2 2,195
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Note: This is the second blog post in a series on email clearinghouses (https://www.xmatters.com/alert-management/blog-email-has-failed-us?utm_campaign=70138000000ydLoAAI&utm_source=exex&utm_medium=article&utm_content=blog-post).   Every month t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

943 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

Need Help in Real-Time?

Connect with top rated Experts

4 Experts available now in Live!

Get 1:1 Help Now