× 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.



Hi Eric,

Someone here did swap emails with Marco offline. I think by native he means something shipped with his system rather than a third party solution - free or not. Fair enough. But you're right, our sftp product is native - just in a different way!

Tim

On 3/18/2013 5:17 PM, DeLong, Eric wrote:
<Scratching my head>
I am just wondering what ISN'T native about the solution presented by Tim?

Did you even look at the link? Their ARP-SFTP product seems perfectly suited to your requirements from what I can tell... Just wondering, really!

-Eric DeLong

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Marco Cecchi
Sent: Monday, March 18, 2013 4:07 AM
To: Midrange Systems Technical Discussion
Subject: R: R: Loop on remote dir with except sftp script for get and rm each files

Thanks Tim for your interesting suggestion but I'm looking for a "native" solution, if someone else could post me some scripting code sample I will prefer.
Regards,
Marco

-----Messaggio originale-----
Da: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] Per conto di Tim Bronski
Inviato: venerdì 15 marzo 2013 14:56
A: Midrange Systems Technical Discussion
Oggetto: Re: R: Loop on remote dir with except sftp script for get and rm each files

Hello Marco,

If you're committed to using the pase ssh and Expect then I'm not much help but if you're looking for alternatives then our sftp client will let you do this very easily (and it's free). It supports password authentication if that's been your problem. It'll let you build dynamic lists, check remote file modified dates etc and even do a "double check"
on file sizes before you choose to delete anything. You can get a copy here:

www.arpeggiosoftware.com

Tim

On 3/15/2013 2:35 PM, Marco Cecchi wrote:
Hello Brad,
sincerely I don't care if I don't get a "just created" file (so your step 3 is unnecessary in my case), while it's a problem if I delete it without havin' got it.
Working under SSH script without a pair key, I need to use EXPECT utility and I think it's a little bit different from a dos batch file.
However can you write me the code part where you can extract files name to pass to GET and RM commands?
Thanks & Regards,
Marco

-----Messaggio originale-----
Da: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Per conto di Bradley Stone
Inviato: venerdì 15 marzo 2013 14:22
A: Midrange Systems Technical Discussion
Oggetto: Re: Loop on remote dir with except sftp script for get and rm
each files

I wrote a script like this once in DOS batch and what I did was this..

1. Get a list of all the remote files to download. This was done by redirecting the results of the DIR command to a file.
2. Use that list to build the FTP script to retrieve files. This is instead of using a *.* for MGET. One GET per item in the list worked so I got everything that was there, and left anything new alone.
3. When done, I would make another list of local files, and compare it to the remote file list to check for any errors.
4. If all was good, I used the initial remote list to remove files from the serve. This way you'll never touch any new files on the server.

Worked slick. :)

Brad
www.bvstools.com


On Fri, Mar 15, 2013 at 6:03 AM, Marco Cecchi <MarcoCecchi@xxxxxxxxxxxx>wrote:

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.


--
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.

--
Need secure FTP? Forget PASE...get your FREE sFTP here www.arpeggiosoftware.com
--
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 thread ...

Replies:

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.