Shell scripting to transfer files from one to another server through ftps


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell scripting to transfer files from one to another server through ftps
# 1  
Old 06-16-2016
Shell scripting to transfer files from one to another server through ftps

Hi Guyz ,,


I'm an ERP functional guy , I really need to automate a script which required a shell script but have a little knowledge in shell scripting.

I need my generated files to be zipped first in one directory lets say (xyz) and then it needs to transfer another ftp server in binary mode through ftps connectivity.

Any help would be appreciated.

Thanks Guyz....
# 2  
Old 06-16-2016
Quote:
Originally Posted by Shogundion
Hi Guyz ,,


I'm an ERP functional guy , I really need to automate a script which required a shell script but have a little knowledge in shell scripting.

I need my generated files to be zipped first in one directory lets say (xyz) and then it needs to transfer another ftp server in binary mode through ftps connectivity.

Any help would be appreciated.

Thanks Guyz....
Hi Shogundion,
What operating system are you using?

What shell are you using?

Show us the commands you would use to zipped your generated files in directory xyz.

Then show us the commands you would use to transfer an ftp server in binary mode using ftps connectivity.

When we understand what commands you would use to do those activities we will help you put those commands in a shell script.

I assume that transferring a server (of any type) is intended to move code from one virtual machine to another virtual machine. Please also tell us what virtualization tools you're using.
# 3  
Old 06-20-2016
the file which use to generate as a dat file i use to make it windows zipped through below command
Code:
ls -1 *<process_instance>*.dat | awk '{ printf ("zip -9 %s.zip %s\n", $1, $1) }' | sh

and then i remove the original dat file using the below command
Code:
rm *<process_instance>*.dat

i need a script to automate the above two steps .
Moderator's Comments:
Mod Comment Please use CODE tags when displaying sample input, sample output, an code segments.

Last edited by Don Cragun; 06-20-2016 at 04:50 AM.. Reason: Add CODE tags.
# 4  
Old 06-20-2016
Quote:
Originally Posted by Shogundion
the file which use to generate as a dat file i use to make it windows zipped through below command
Code:
ls -1 *<process_instance>*.dat | awk '{ printf ("zip -9 %s.zip %s\n", $1, $1) }' | sh

and then i remove the original dat file using the below command
Code:
rm *<process_instance>*.dat

i need a script to automate the above two steps .
Moderator's Comments:
Mod Comment Please use CODE tags when displaying sample input, sample output, an code segments.
The command:
Code:
ls -1 *<process_instance>*.dat

will not work with any shell I have ever used. The literal < and > characters in your filename matching pattern will be interpreted as redirection operators; not as characters to be found in your pathnames. If you don't intend for those to be literal characters in the names of the files you want to process, you need to be much clearer in what names you are trying to match.

Assuming that you're using a shell based on Bourne shell syntax and you really do want to process files in the current working directory whose names contain the literal string <process_instance> and end in the literal string .dat, try:
Code:
for file in *'<process_instance>'*.dat
do	zip -9 "$file".zip "$file" && rm "$file"
done

Note that unlike the two commands you are using, this loop will not remove files that were not successfully zipped.

Note that unlike the two commands you are using, this loop will correctly process files even if filenames contain whitespace characters or characters that are special filename pattern matching characters (like *, ?, and [).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Not able to transfer files using between server A and B

Hi All, I have generated public and private pair to avoid to enter password manually while sending files through sftp. But still I am facing issues and every-time prompt asking enter password. Below are steps I fallowed to make ssh connection between two servers. 1. Generated public and... (5 Replies)
Discussion started by: renukeswar
5 Replies

2. UNIX for Advanced & Expert Users

Best way to transfer files to remote FTPS server instead of local FTPS server

Hi, I am working on an application which runs on an Informatica Red-Hat 5.10 Linux Server. The application involves several Informatica ETL workflows which generate 100s of Text files with lot of data. Many of the files will each be up to 5 GB in size. Currently the Informatica server itself... (7 Replies)
Discussion started by: waavman
7 Replies

3. Shell Programming and Scripting

File transfer using FTPS(SSL)

Hi Team, I am currently working on an integration project where in we have planned to receive files from an external source onto our system via FTPS(SSL). I am new to this part and would like to know the points for consideration and the points to learn to get this done. The files we receive from... (1 Reply)
Discussion started by: Rads
1 Replies

4. Shell Programming and Scripting

Do I require remote login access to a windows server to transfer files from a UNIX server

Hi All I need to transfer a file from a UNIX server to a windows server. I saw that it is possible to do this using scp command by looking at the forum listed below: ... (2 Replies)
Discussion started by: vx04
2 Replies

5. Shell Programming and Scripting

Help with script to transfer files from one server to another

Hi I have the following script: #!/bin/sh set -x touch -mt 201210040000 /tmp/ref1 touch -mt 201210042359 /tmp/ref2 find /fs1/bscsrtx/BSCS_ix/WORK/LOG -type f \( -newer /tmp/ref1 -a ! -newer /tmp/ref2 \) > file_lst scp $(< file_lst) root@10.100.48.76:/ano2005/fs1_2015/LOG/ but somehow its... (7 Replies)
Discussion started by: fretagi
7 Replies

6. UNIX for Dummies Questions & Answers

Lftp for a remote server which uses FTPS

Hi All, I am new to SHell scripting, can someone please help me with the below requirement. 1) LFTP a file to a remote server which supports FTPS. My current enviroment is Sun Solaris 5.10 2) I need to incorporate this in a shell which is currently sending files to a server that accepts... (1 Reply)
Discussion started by: subbu
1 Replies

7. Shell Programming and Scripting

Shell Scripting for creating ftp and transfer file

Dear All, We run backup script to update backup file every hour. I want to create a script, which transfer these files in another server using ftp as new backup file created every hour. Files should be stored with a unique name for every hour(e.g 20130708_13:00 , 20130708_14:00 and so on) and... (13 Replies)
Discussion started by: Preeti Saini
13 Replies

8. Shell Programming and Scripting

SFTP to transfer files from one server to another

Hello, i have to write a script to perform sftp from the remote server to another server. the files which are at the remote location are huge data log files which should be transfered to my server in a particular folder. could you please provide me the general code (simple )... (1 Reply)
Discussion started by: urfrnddpk
1 Replies

9. Shell Programming and Scripting

Shell script to transfer the files from source to target server.

I need to write a shell script to transfer the files every hour from source - target server. The cron job should be running every hour and shouldn't copy already copied files to the remote server ? I was able to write intial script but not able to get the logic for (in the next run it should... (12 Replies)
Discussion started by: radhirk
12 Replies

10. Linux

transfer files from the server 1 to server 2

I want to transfer files from the server 1 to server 2, but only information available FTP my server 2 How? Is there a script help me in the transfer of files through FTP :( (2 Replies)
Discussion started by: bomozah
2 Replies
Login or Register to Ask a Question