Sponsored Content
Top Forums Shell Programming and Scripting [Solved] Simple Shellscript for uploading files to a specific folder on a ftp-server? Post 302886750 by Nigge on Monday 3rd of February 2014 12:12:54 PM
Old 02-03-2014
Ok thanks for your helpSmilie Im sorry if there was a lot of information missing, we live and we learn;-)

Ok...
The script that seems to match my needs is:
Code:
#!/bin/bash

HOST=ftp.server.com  #This is the FTP servers host or IP address.
USER=(myftpusername)             #This is the FTP user that has access to the server.
PASS=mypassword          #This is the password for the FTP user.

# Call 1. Uses the ftp command with the -inv switches.  -i turns off interactiv$

ftp -inv $HOST << EOF

# Call 2. Here the login credentials are supplied by calling the variables.

user $USER $PASS

# Call 3. Here you will change to the directory where you want to put or get
cd /public_html/fotosupport.se/Nigge

# Call4.  Here you will tell FTP to put or get the file.
put test.txt

bye
EOF

When I run it I get the following:
Quote:
./ftpscript.sh: line 22: warning: here-document at line 9 delimited by end-of-file (wanted `EOF')
ftp: invalid option -- i
ftp V1.00.10182010
Usage
start : start ftp server
stop : stop ftp server
restart : restart ftp server
reload : reload ftp.xml from disk
create-link : user change group need to re-create all link
write-magic-number : write ftp magic to mtd , hd
show : show ftp share list
-A : Add command
-D : Del command
-M : Modify command
-R : Remove command
-n : ftp share name
-p : ftp share path
-r : read list
-w : write list
-d : deny access list
-c : clean ftp share
-h : help
-x : add block IP. EX: ftp -x xxx.xxx.xxx.xxx,1/0(type), 1~31(days)
-z : remove blocked IP
-b : setting blocking duration
-t : setting monitor ftp retry in period
-E : enable/disable anonymous user access ftp
-u : user or group
-a : attribute(0->calcel ,1->R , 2->R/W 3->denny access
ftp start , ftp stop , ftp restart , ftp reload
ex: ftp -A -n abc -p /mnt/HD/HD_a2/123 -r "#a1#" -w "#a2#,#a3#" -d ""
ex: ftp -D -n abc
ex: ftp -M -n abc -r "#a1#" -w "#a2#,#a3#" -d ""
ex: ftp -M -n abc -u a1 -a 1
ex: ftp -R -u a1
And once again, thanks a lot for your help:-)
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ftp a files from a folder

Hi Can anyone give me a shell script to ftp all the files in a folder to a another machine .And if the ftp is sucees i want to move the files to the same to another folder in the same client m/c (2 Replies)
Discussion started by: dineshr85
2 Replies

2. Shell Programming and Scripting

Simple script uploading *.dem files to an ftp

Hello.. i want to create a simple script that's upload all the *.dem files from one directory to ftp and then delete them. Any help? (3 Replies)
Discussion started by: TuXaKoS
3 Replies

3. UNIX for Dummies Questions & Answers

To find files with specific dates and cp another folder.

Hi all, We have an existing script: find /u03/oraprod/perpcomn/admin/out -type f -ctime +7 \ -exec cp {} "/u08/oraprod/backup/cout" \; Which is to find all files more than 7 days and copy to another folder. However I would like to only list files with Sep 29, and cp to another folder. ... (2 Replies)
Discussion started by: *Jess*
2 Replies

4. Shell Programming and Scripting

how to FTP a file from the local folder to unix server

Hi All, please help me to write a shell that ftp a file which is in the local (C:\) drive to a Unix server. Where as i know the IP for the Unix server. i could do this process by using ftp command. pls help me to write as Shell script. Thanks in advance for all of your answers.:b::b: (3 Replies)
Discussion started by: little_wonder
3 Replies

5. Shell Programming and Scripting

transfering files with a specific name to a folder

Hi I want to transfer all files in a folder to another folder. So the files have a ending of .lop.txt thanks (4 Replies)
Discussion started by: gisele_l
4 Replies

6. HP-UX

[Solved] Unable to rename file in ftp server .Net:FTP perl

Hello All, I am trying to connect to ftp server and get the files. Also i need to rename the file in other ftp dir. rename method is not allowing me to rename the file in other dir. When i tried copy command by using net::FTP:FILE then perl says it is not installed. Can some body help me to... (2 Replies)
Discussion started by: krsnadasa
2 Replies

7. UNIX for Dummies Questions & Answers

[Solved] Touch 10% of the total files inside a folder

I'm trying to make this code below to work but I can't find the way to do the following: I want to make the script to touch only 10% of the total amount of files counted inside the given directory instead of all like it is now. I would greatly appreciate it if someone can give me a direction on... (9 Replies)
Discussion started by: regraphix
9 Replies

8. Shell Programming and Scripting

Copy folder and files from unix server to linux server

We would be migrating unix solaries to Linux redhat. Basically source is unix and target is linux. i would like to copy entire file system unix/source/* to target linux/souce/* but target linux has only folder setup so what ever files copied need to be placed in the linux server with same... (8 Replies)
Discussion started by: balajikalai
8 Replies

9. Shell Programming and Scripting

Shell scripting for moving folder specific files into target directory of that country folder.

I need help to write shell script to copy files from one server to another server. Source Directory UAE(inside i have another folder Misc with files inside UAE folder).I have to copy this to another server UAE folder( Files should be copied to UAE folder and Misc files should be copied in target... (3 Replies)
Discussion started by: naresh2389
3 Replies
ftpconfig(1M)						  System Administration Commands					     ftpconfig(1M)

NAME
ftpconfig - set up anonymous FTP SYNOPSIS
ftpconfig [ftpdir] ftpconfig -d ftpdir DESCRIPTION
The ftpconfig script is executed by the super user to set up anonymous FTP. Anonymous FTP allows users to remotely log on to the FTP server by specifying the user name ftp or anonymous and the user's email address as password. The anonymous users are logged on to the FTP Server and given access to a restricted file area with its own file system root. See chroot(2). The FTP area has its own minimal system files. This command will copy and set up all the components needed to operate an anonymous FTP server, including creating the ftp user account, creating device nodes, copying /usr/lib files, and copying timezone data. The passwd and group files set up have been stripped down to prevent malicious users from finding login names on the server. The anonymous file area will be placed under ftpdir. If the ftp user account already exists, then the current FTP area is used, and the system files in it are updated. All other files are left untouched. This command should be run to update the anonymous FTP area's configuration whenever a system patch is installed, or the system is upgraded. OPTIONS
-d Create a new or update an existing ftpdir without creating or updating the ftp user account. Use this option when creating guest FTP user accounts. OPERANDS
The following operands are supported: ftpdir The absolute pathname of the directory under which the anonymous FTP area is set up. EXIT STATUS
The following exit values are returned: 0 Successful completion 1 Improper usage of the command 2 Command failed ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWftpu | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
ftpaddhost(1M), in.ftpd(1M), useradd(1M), chroot(2), attributes(5) SunOS 5.10 1 May 2003 ftpconfig(1M)
All times are GMT -4. The time now is 10:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy