× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello,
I created a simple script that get all files in a remote then delete all:
_______________________________________________________________________
#!/usr/local/bin/expect -f
set timeout 20
spawn sftp $env(SSH_USER)@$env(SSH_HOST)
expect {
default {exit 2}
"continue connecting (yes/no)?" {send "yes\n"; exp_continue}
"assword:" {send "$env(SSH_PASS)\n"; exp_continue}
"sftp>"
}
send "get * /XML/OrdFor/Ricevuti/\n"
expect {
default {exit 2}
"not found" {exit 0}
"sftp>"
}
send "rm *\n"
expect {
default {exit 2}
"not found" {exit 3}
"sftp>"
}
send "quit\n"
exit 0

It "works" but files in that directory are dynamics so I risk to delete someone just arrived after I copied the rest.
So I'm looking for a sample code to cycle the remote directory in order to GET and RM each single file.

Thanks in advance,
Marco Cecchi
DATACOM Srl

_________________________________________________________________________________________________________________
Ai sensi del D. Lgs. 196/03 si precisa che le informazioni contenute in questa e-mail ed eventuali suoi allegati sono riservate e ad uso esclusivo del destinatario. Qualora il messaggio Vi fosse pervenuto per errore, Vi invitiamo ad eliminarlo senza copiarlo e a non inoltrarlo a terzi, dandocene immediata comunicazione. Grazie.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.