[Need HELP] Find aging file and auto FTP


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [Need HELP] Find aging file and auto FTP
# 1  
Old 02-26-2013
[Need HELP] Find aging file and auto FTP

Dear Experts,

I have script to find aging file like this:

find /ArchiveINTF/INTF name "*" -type f -mtime +365 {} \; >> agingfile.txt

This script will find all files over 365 days.

But, I have problem, how to auto FTP all files?

Thanks
Edy
# 2  
Old 02-26-2013
Try this:

Code:
ftp -i -n host.domain <<EOF
quote USER <username>
quote PASS <password>
cd <dir>
ls
mput $(cat agingfile.txt | tr '\n' ' ')
ls
close
EOF

# 3  
Old 02-26-2013
Hi Mirni,

Thank you for your response.

How to define dynamic directory?
It's too many directory under /ArchiveINTF/INTF

And output on aging.txt is full path. example /ArchiveINTF/INTF/AOP/100/INBOUND/WMS/SOI/PROCESSED/WMS_SAP_SOI_000000626803_1510

# 4  
Old 02-26-2013
You might want to use lftp(1). Much easier. Make a small shell script that does it all:
Code:
#!/bin/bash

makeFTPscript() {
    cat <<EOF
open ftp://<user>:'<pass>'@<host>
cd <dir>
ls
mput $(cat $1 | tr '\n' ' ')
ls
EOF
}

#generate the script
makeFTPscript agingfile.txt >ftp.cmd

#run the ftp script:
lftp -f ftp.cmd

If the connection is refused due to non-verifiable certificate, just add a line
Code:
set ssl:verify-certificate 0

to your ~/.lftprc (create it if doesn't exist).

Last edited by mirni; 02-26-2013 at 02:17 PM.. Reason: cert fix
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[HELP] Scripts moving aging file by FTP

Hi Experts, Kindly share scripts to find aging file and ftp to another server.. Example: Find files more than 5 days and ftp to another server. Please give suggestion :) Thanks Edy (1 Reply)
Discussion started by: edydsuranta
1 Replies

2. Shell Programming and Scripting

Aging file not use and touch

Hi all, Need advice from expect, below is my scripts to find the file not use and touch in storage and other directory. This scripts divide by: 1. 30 days 2. 90 days 3. 180 days 4. 1 years 5. 3 years 6. 5 years Then count total size in GB from 6 each category. Sample my... (5 Replies)
Discussion started by: sheikh76
5 Replies

3. Shell Programming and Scripting

Auto Ftp pseudo random file

I have a script that generates a file which is my own incarnation of a date using the 'date' function (we'll call this script a). I would like that script to invoke my other script (script b) which contains my ftp info. Since I have yet to figure out a good way to use regular ftp (yes i can only... (6 Replies)
Discussion started by: DC Slick
6 Replies

4. UNIX for Dummies Questions & Answers

How to auto find a string when using less command?

I want to "less" a file and go to first occurrence of a string in one command. Is it possible? Thanks! (2 Replies)
Discussion started by: carloszhang
2 Replies

5. Shell Programming and Scripting

FTP problem to find file

Hi everybody, i suddenly got in a requirement whereby: I have to create a script whereby I need to connect with a remote server with a FTP script and search whether a file named filename.txt or *.txt exists or not in the remote server. If it exists then my script has to return a value. ... (18 Replies)
Discussion started by: RubinPat
18 Replies

6. UNIX for Advanced & Expert Users

Using FTP to check whether file is completely FTP... plz find the description below

Hi, We have some clients who will place huge files in to one of the remote server. And the shell script written in our local server to retrieve client files (using FTP) placed on one of the remote server of ours by clients. My question Is there any FTP command/script to check from my local... (1 Reply)
Discussion started by: nmsrao
1 Replies

7. UNIX for Advanced & Expert Users

Count and Auto FTP

Hi, I really need to create a script that counts for file and ftp's them to a windows directory. !st problem i'm having is getting it to ftp withouty prompting me, i tried |& on the end of the ftp, but then it just hits a syntax error. 2nd problem is, i have to have a wildcard in this script. which... (3 Replies)
Discussion started by: dappa
3 Replies

8. Shell Programming and Scripting

auto ftp the files

i have writen a shell to ftp a file automatically by taking the input from a file i have created on file tstftp as set timeout 120 ftp spawn ftp expect "ftp>" send "o 11.90.2.20 \r" expect "Name:" send "itcomxxl\r" expect "Password:" send "csms091206\r" expect "ftp>" send "prompt... (1 Reply)
Discussion started by: sasiprabu
1 Replies

9. Programming

Auto FTP from UNIX to Windows Server

Hi, I am a not strong programmer and now my boss ask me how should I do a job to automated FTP that have error check. I know about: * using system() to call a command to trigger ftp in C Coding. The senarios as follows: 1. FTP the file(s) (e.g ELA_20060407.dat) to a given LAN server... (1 Reply)
Discussion started by: songtam
1 Replies

10. Shell Programming and Scripting

Auto FTP to a server

Hi, I am trying to automate FTP login to a remote server and put a file there. But no matter what i do, It still is aksing me for the login and password although i have it defined in the variable. Could you tell me what is wrong with this script. I am doing this on SUN server. Pls... (11 Replies)
Discussion started by: systemali
11 Replies
Login or Register to Ask a Question