Jeg har et problem med et script, jeg gerne vil have til at forbinde til en FTP-server, for derefter at downloade fra en given mappe til en given mappe på min pc. Jeg har forgæves søgt efter løsninger på mit problem, så håber at en af jer har en god idé.
Scriptet:
Kode: Vælg alt
#!/bin/bash
USERNAME="username"
PASSWORD="passwd"
SERVER="xx.xx.xx.xx"
# local directory
HOME="/home/user/Desktop/"
# remote dir
FILES="/BACKUP/"
# login to remote server
ftp -ivn $SERVER <<cmd
user $USERNAME $PASSWORD
bin
cd $FILES
lcd $HOME
prompt off
mget *
bye
cmd
Scriptet gør dog kun følgende:
Connected to xx.xx.xx.xx.
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 02:30. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
Remote system type is UNIX.
Using binary mode to transfer files.
331 User OK. Password required
230-User has group access to: 1001
230-This server supports FXP transfers
230 OK. Current directory is /
Remote system type is UNIX.
Using binary mode to transfer files.
200 TYPE is now 8-bit binary
250 OK. Current directory is /BACKUP
Local directory now /home/user/Desktop
Interactive mode on.
221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
221 Logout.
Er jeg helt galt afmarcheret?
På forhånd tak for hjælpen.
Mvh
Presidente.