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
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
Try this:
ftp -i -n host.domain <<EOF
quote USER <username>
quote PASS <password>
cd <dir>
ls
mput $(cat agingfile.txt | tr '\n' ' ')
ls
close
EOF
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
You might want to use lftp(1). Much easier. Make a small shell script that does it all:
#!/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
set ssl:verify-certificate 0
to your ~/.lftprc (create it if doesn't exist).