Script to FTP,clean up and email


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to FTP,clean up and email
# 1  
Old 06-11-2012
MySQL Script to FTP,clean up and email

Hi i need a unix script to do the following tasks.
My folder structure is /home/MSTR/test and will have the following folder within it
Cache
Lookup
Source
Target
1. On the Source & Target folder i have to take a copy of files older than 5 days and move(FTP) it into local machines C:\Backup drive.Then remove the old files.
2. On the Cache and look up folders i have to take a copy of files older than 2 days and move(FTP) it into local machines C:\Backup drive.Then remove the old files.
3. On the days before removing i have to send a mail to a mail id stating that these files from this path will be removed by tomorrow.
# 2  
Old 06-11-2012
you have put a question or assignment here?

for file searching older than 5 days
Code:
 find dir_name/file_pattern -type f  -mtime +5

use a temp file to list your desired files and use it where ever you want.

for ftp use
Code:
ftp -v -n <server_node> << EOF
user <user_id> <password>
bin
hash
cd <remote_dir>
lcd <local_dir>
mput <files>
bye
EOF

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

UNIX Script to clean files

Hello All, I need a script that would delete files which are more than "X" number of days old, also if there can be a log file of the deleted files for reference. I am from windows background hence finding it difficult. Any help is much appreciated Regards Wert (4 Replies)
Discussion started by: wert468
4 Replies

2. UNIX for Dummies Questions & Answers

'awk' help for script to clean out wireless.

I've been working on a script to clean out the wireless connections on my MAC. I know the terminal command to do this (that part is not rocket science ;) ) So I thought I would have a go at automating this but I'm having trouble with the 'awk' command & the correct context. My code is := ... (7 Replies)
Discussion started by: Lord Lien
7 Replies

3. Shell Programming and Scripting

lftp script to connect to external sftp site and download to internal ftp and then send email

Hi there, I'm new to shell scripting and need some help if possible? I need to create a shell script (.sh) to run as a cron job on an ubuntu linux server to connect to an external sftp sites directory using credentials (which I have) and then download to our internal ftp server and then copy... (3 Replies)
Discussion started by: ghath
3 Replies

4. Shell Programming and Scripting

[SOLVED] help clean up file movement script

Hello Group, Once again another script hacked together from a few sources to try and suit my needs. This is to go through a /temp directory and for each ls entry ask which Dir of three I want it sorted. The script works but there are a few behaviors that are odd so I figured I'd ask for help... (2 Replies)
Discussion started by: dpreviti
2 Replies

5. Shell Programming and Scripting

Need a shell script to clean data

Hi, Appreciated if anyone can throw some hint I have a file format like this: old(1): PRCNCP 1 old(2): PRSKU ... (6 Replies)
Discussion started by: netbanker
6 Replies

6. Shell Programming and Scripting

How to clean this script?

Hello guys, this script partially works but it's still pretty ugly and, moreover, if the month is jan/feb/mar... it doesn't work at all. Could anyone say me how to correct, cut and clean a little bit? #!/usr/bin/ksh egrep -v -e "^\s*#" /file/permission | awk '{ print $1 }' | sort | uniq... (3 Replies)
Discussion started by: gogol_bordello
3 Replies

7. Shell Programming and Scripting

ftp, archive, email and delete from shell script

Hello, I found the forum’s information very helpful and informative. I am relatively new to UNIX programming. I am researching how to write a UNIX shell script to ftp all files from specific host folder to a client server. Also need to archive all transferred files, send a message (email) if any... (4 Replies)
Discussion started by: Lenora2009
4 Replies

8. OS X (Apple)

Startup script to clean out trash can

I need to know how I would be able to clean out the trash can of a single "dumb" user every time the MAC is turned on. Back ground. OS 10.3x G3 Mac Two users configured... 1) Root or Admin (superuser) 2) student (Simple no access to anything but shared folder for files etc.) The problem... (4 Replies)
Discussion started by: Andrek
4 Replies

9. Shell Programming and Scripting

clean up script

I have a script which would monitor a given directory and delete any files which are older than 10 days. I was going to set the 10 crob jobs to perform this operation for 10 different directories (some are actually sub-directories), but my boss doesn't like that idea, so I need to do that in one... (1 Reply)
Discussion started by: mpang_
1 Replies

10. Shell Programming and Scripting

writing script to clean up a directory

I have to do a directory clean up on several machines. The task is as follows: go to a particular directory (cd /xxx) 1. create a directory ' SCRIPTCLEANUP ' ( i KNOW IT) loop through 2. List the directory 3. if directory and start with 'DQA' leave it, 4. if directory or file move it to... (0 Replies)
Discussion started by: ajaya
0 Replies
Login or Register to Ask a Question