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.   


  3. #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

  4. #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

  5. #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
Running a command from inside a script, command line is corrupted PowerShell
How to use command line to compression/uncompress folder for Vista Vista General
Command Line Ren (Rename) command broken? Vista General
Command line fonction to move the Documents folder in Vista Vista General
is there command line to set folder and file security setting? PowerShell