|
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.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
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.