LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Bash put script (https://www.linuxquestions.org/questions/programming-9/bash-put-script-227259/)

jnusa 09-06-2004 07:32 AM

Bash put script
 
Anyone know where I can find a put procedure to copy several files with one function call (during ftp session). Alternative could be to copy a directory (haven't been able to google anything usefull). Any information will be greatly appriciated.

/Jasper

elsheikhmh 09-06-2004 07:43 AM

what about mput and mget instead of put, and get

Cedrik 09-06-2004 02:09 PM

You can use curl, say for upload all jpeg files in current directory :

Code:

#!/bin/bash

UPLOAD_DIRECTORY="$PWD"
FTP_PASS="password"
FTP_USER="me"
FTP_HOST="ftp.myhost.com"
FTP_DIR="/path/to/upload/files/in/ftp/server"
FTP_URL="ftp://$FTP_USER:$FTP_PASS@$FTP_HOST/$FTP_DIR"
FTP_UP=

for image in `find $UPLOAD_DIRECTORY -name "*.jpg"`; do
    image_name=`basename $image`
    FTP_UP="$FTP_UP -T $image $FTP_URL/$image_name"
done
curl  $FTP_UP


jnusa 09-07-2004 02:31 AM

exactly what I'm looking for.... appriciate it Cedrik.


All times are GMT -5. The time now is 11:56 PM.