[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

ftp command line

Posted on 2001-07-25
12
Medium Priority
?
221 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
[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
  • 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
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
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
 
LVL 5

Author Comment

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

Accepted Solution

by:
DanielBlais earned 600 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
What monsters are hiding in your child's room? In this article I will share with you a tech horror story that could happen to anyone, along with some tips on how you can prevent it from happening to you.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

650 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