Solved

ftp command line

Posted on 2001-07-25
12
208 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

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…
Knowing where your website is hosted is as important as the features you receive, the monthly fee, and the support you receive. Due diligence should be done when choosing your next hosting provider.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

773 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