Need help creating a script to FTP files to a server and then delete the files that were transfered.
I am trying to FTP files to a Windows server through my Linux machine. I have setup the file transfer with no problems but am having problem deleting those files from the Linux box. My current non-working solution is below. Any ideas, anyone?? Please be gentle, I'm fairly new to this scripting thing.
#Will move audio files from <Linux> to <Windows>
#Sets the current directory to the audio storage area on the server.
Last edited by methyl; 01-17-2012 at 07:55 PM..
Reason: please use code tags
"#!/bin/bash" must be the very first line. Not the second or third. If it's not the first line, you may not get the shell you want, or it may not run at all.
What are the lines beginning with "!" for? If you want a comment, the line should begin with "#", not "!".
I think you're confused on what << is for. It doesn't read a file name. It defines text inside the script to feed into something else -- it acts sort of like file redirection in that programs read data on standard input from it, but it's not really a file.
Try this:
That should cause cat to print "this is a line of text". It's like cat < filename except it's reading data that your script gives it instead of reading from a file that was redirected into it.
You're feeding commands into FTP the same way, but haven't got it quite right. Try this:
Note that the ending "SOMESTRING" is right at the beginning of the line. This isn't optional. If it's not at the beginning of the line, the here document may just never end!
Hi
I am new to Linux / scripting language. I need to improve our Linux servers at work and looking to claim some space my deleting log files/ folders on a 5 day basis.
Can someone help me with creating a script to do so.
Any sample script will be helpful.:b:
Regards (2 Replies)
Hi experts,
can anyone suggest me on the below:
how to write a shell script to search and delete files on windows server.
-script runs on unix box
-it should search for specific files on windows server and delete them periodically. (2 Replies)
suppose one file comes in one sever location on MOnday.we have to write a script to automatically get that files and put it in different server location.
---------- Post updated at 10:28 AM ---------- Previous update was at 10:27 AM ----------
Please help me on this (2 Replies)
Hi Guru's,
I am new to UNIX. my requirement is to log on to FTP server and get all the .txt files. i have developed one script by searching some forums but getting error and not able to fix them. pls see below code.
ftp -i-n<<EOF
open $FTP_HOST... (30 Replies)
I need help in writng a script to delete last three days files from a remote server using only FTP / SFTP. I was using find command which is not working and i cant use ssh Immediate response is highly appreciated .
Thank in advance!
---------- Post updated 12-05-10 at 09:16 PM ----------... (5 Replies)
Hi,
I need to ftp some input files from windows to unix server.All the files will be saved in the C drive in my machine.
Currently all these files are transferring manually to the unix server.I need to write a shell script which ftp the files
from windows to unix box.When I searched in the... (10 Replies)
Hi
I just started learning Unix scripts.
I need to access an FTP server, delete all the files except the latest 6 files and the latest 6 files should be downloaded to my local server. Could some body help me to code this logic in KSH ?
Thanks
Athena (1 Reply)
I have a driectoty called TEMP on server 1.There is a process running on another server which is pushing files in this directory of server 1.
I want to write a script which will move the files from TEMP directory to TEMP2 directory on server 1 only but make sure that it will only copy those files... (2 Replies)