Windows Vista Forums

FTP a folder from command line

  1. #1


    Jake Guest

    FTP a folder from command line

    Hi,

    I need to transfer a folder structure (recursively) to a remote ftp
    server from a script in my win2008 server. I've tried using mput but it
    does not seem to work.

    Thanks for an example copying C:\MyStuff (all subfolders and files) to
    192.168.12.1 by ftp from the commandline.

    Thanks a lot :-)

    regards

    jake

      My System SpecsSystem Spec

  2. #2


    Pegasus [MVP] Guest

    Re: FTP a folder from command line


    "Jake" <jake44@newsgroup> wrote in message
    news:eiiCnk7YKHA.2160@newsgroup

    > Hi,
    >
    > I need to transfer a folder structure (recursively) to a remote ftp server
    > from a script in my win2008 server. I've tried using mput but it does not
    > seem to work.
    >
    > Thanks for an example copying C:\MyStuff (all subfolders and files) to
    > 192.168.12.1 by ftp from the commandline.
    >
    > Thanks a lot :-)
    >
    > regards
    >
    > jake
    Let's have a look at your script that did not quite work!



      My System SpecsSystem Spec

  3. #3


    Jake Guest

    Re: FTP a folder from command line

    Pegasus [MVP] skrev:

    > Let's have a look at your script that did not quite work!
    In the file ftpscriptfull-1.txt below I have tried various options:
    C:\DirWithSubfolders
    C:\DirWithSubfolders\
    C:\DirWithSubfolders\*.*

    Contents of file ftpscriptfull-1.txt:

    user moses <passwrd>
    mput C:\DirWithSubfolders
    bye

    Contents of actual batch file:

    ftp -n -s:c:\bogus\ftpscriptfull-1.txt 192.168.100.13
    echo Full file copy completed at %time% - %date% >> C:\bogus\log.txt

    I want to copy C:\DirWithSubfolders with all its files and subfolders.

    regards jake

      My System SpecsSystem Spec

  4. #4


    Pegasus [MVP] Guest

    Re: FTP a folder from command line


    "Jake" <jake44@newsgroup> wrote in message
    news:%23LbyhOEZKHA.4920@newsgroup

    > Pegasus [MVP] skrev:

    >> Let's have a look at your script that did not quite work!
    >
    > In the file ftpscriptfull-1.txt below I have tried various options:
    > C:\DirWithSubfolders
    > C:\DirWithSubfolders\
    > C:\DirWithSubfolders\*.*
    >
    > Contents of file ftpscriptfull-1.txt:
    >
    > user moses <passwrd>
    > mput C:\DirWithSubfolders
    > bye
    >
    > Contents of actual batch file:
    >
    > ftp -n -s:c:\bogus\ftpscriptfull-1.txt 192.168.100.13
    > echo Full file copy completed at %time% - %date% >> C:\bogus\log.txt
    >
    > I want to copy C:\DirWithSubfolders with all its files and subfolders.
    >
    > regards jake
    Ftp.exe is a fairly primitive program. To compensate for its lack of
    sophistication, you have to add some intelligence to the batch file that
    invokes it, e.g. like so:

    @echo off
    set Source=d\Friday
    if not %Source:~1,2%==:\ (
    echo You must specify a fully qualified source folder, e.g. D:\My Files
    pause
    goto :eof
    )
    call :Sub %Source%
    for /F "delims=" %%a in ('dir "%Source%" /ad /b /s') do call :Sub %%a
    goto :eof

    :Sub
    set Folder=%*
    set Folder=%Folder:~3%
    set Folder=%Folder:\=/%
    echo Copying files from "%*" to "%Folder%"

    set script=c:\script.scr
    set site=www.MySite.com
    set account=JakeKlefbeck
    set password=Lisa

    echo> %script% %account%
    echo>>%script% %password%
    echo>>%script% binary
    echo>>%script% prompt off
    echo>>%script% cd usr/home/jake
    echo>>%script% mkdir "%Folder%"
    echo>>%script% cd "%Folder%"
    echo>>%script% mput "%*\*.*"
    echo>>%script% quit
    ftp -s:%script% %site%
    del %script%



      My System SpecsSystem Spec

FTP a folder from command line

Similar Threads
Thread Forum
Command Prompt doesnt seem to recognize the command line!!
Hello, I'm trying to split a .flv file by using flvparse, which is a Windows-only, command-line interface tool. I did get through to the directory...
Network & Sharing
Running a command from inside a script, command line is corrupted
Hello, I am trying to give Powershell a chance, since it seems like it may have some promise. I have this powershell script that needs to run...
PowerShell
How to use command line to compression/uncompress folder for Vista
Dear all, How to use command line to compression/uncompress folder for Vista Thank You!
Vista General
What is the command line command for unzipping files?
On a stock Vista box we need to be able to extract files from a zip file from a command line batch script. I can't seem to find a command for this....
Vista General
Command Line Ren (Rename) command broken?
I'm having trouble with the REN command with wild cards as used from the command prompt. For example, in the REN command help, it says: "For...
Vista General
Command line fonction to move the Documents folder in Vista
I would like to move the Documents folder to a new location ( D:\Profile\Username\Documents ). I know there is way to do that by right clicking on...
Vista General
is there command line to set folder and file security setting?
like "full control", "list folder"?
PowerShell