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

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.

the file which use to generate as a dat file i use to make it windows zipped through below command

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

rm *<process_instance>*.dat

i need a script to automate the above two steps .

The command:

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:

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 [ ).