From: Atropo on
On Jun 14, 1:05 pm, Michael Vilain <vil...(a)NOspamcop.net> wrote:
> In article
> <ade391fd-f5d3-420d-90f0-22dbcd500...(a)k39g2000yqd.googlegroups.com>,
>
>  Atropo <lxvasq...(a)gmail.com> wrote:
> > Hi all,  I'm on solaris 5.10 and trying to get several files from
> > windows server, but with the condition that the files do not have the
> > extension ".par"  (partial or being processed). help mget is not very
> > helpful.
>
> You can "mget *" and answer "N" to the .par files.  Or get a list of
> files, and mget only the ones you want.  'Fraid the standard
> command-line ftp client doesn't have any sort of exclude option.  From a
> GUI front-end like Interarchie on Macintosh, I can selected files in a
> directory, then unselect ones I don't want graphically and drag the
> selected files to my desktop to transfer them.
>
> But a specific exclude feature does not exist.
>
> --
> DeeDee, don't press that button!  DeeDee!  NO!  Dee...
> [I filter all Goggle Groups posts, so any reply may be automatically ignored]

Thanks Michael, but this intended to be a script to run via crontab
on ciclycal basis.
but maybe you can help me to achieve other idea like.

create a list of files on remote (maybe excluding)
get this list ( don't know if can do it from local)
parse the list (as a here document)

but don't know the steps to accomplish this
From: John Kelly on
On Mon, 14 Jun 2010 12:09:46 -0700 (PDT), Atropo <lxvasquez(a)gmail.com>
wrote:

>> > Hi all, �I'm on solaris 5.10 and trying to get several files from
>> > windows server, but with the condition that the files do not have the
>> > extension ".par" �(partial or being processed). help mget is not very
>> > helpful.

>Thanks Michael, but this intended to be a script to run via crontab
>on ciclycal basis.
>but maybe you can help me to achieve other idea like.
>
>create a list of files on remote (maybe excluding)
>get this list ( don't know if can do it from local)
>parse the list (as a here document)
>
>but don't know the steps to accomplish this

The tool you need is wget. Its ftp globbing feature may not be good
enough for your purpose, but you can download a list from the server,
process it with grep to produce a new, restricted list, and use that
with wget.



--
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php

From: Mart Frauenlob on
On 14.06.2010 21:09, Atropo wrote:
> On Jun 14, 1:05 pm, Michael Vilain<vil...(a)NOspamcop.net> wrote:

>> Atropo<lxvasq...(a)gmail.com> wrote:
>>> Hi all, I'm on solaris 5.10 and trying to get several files from
>>> windows server, but with the condition that the files do not have the
>>> extension ".par" (partial or being processed). help mget is not very
>>> helpful.
>>
>> You can "mget *" and answer "N" to the .par files. Or get a list of
>> files, and mget only the ones you want. 'Fraid the standard
>> command-line ftp client doesn't have any sort of exclude option. From a
>> GUI front-end like Interarchie on Macintosh, I can selected files in a
>> directory, then unselect ones I don't want graphically and drag the
>> selected files to my desktop to transfer them.
>>
>> But a specific exclude feature does not exist.
>>

> Thanks Michael, but this intended to be a script to run via crontab
> on ciclycal basis.
> but maybe you can help me to achieve other idea like.
>
> create a list of files on remote (maybe excluding)
> get this list ( don't know if can do it from local)
> parse the list (as a here document)
>
> but don't know the steps to accomplish this

another option could be 'curl'.
It has many features useful for scripting that kind of thing.

1: You may fetch the remote listing with:
-l/--list-only
(FTP) When listing an FTP directory, this switch
forces a name-only view. Especially useful if you want to machine-parse
the contents of an FTP
directory since the normal directory view doesn't use a
standard look or format.

2: generate the transfer list with some like:
grep -v ".*.par" fetched_list >new_list
(don't know if -v is portable)

3: feed that new_list to curl.

'man curl' for details.


Hope it helps.

Best regards

Mart




From: Atropo on
On Jun 14, 4:51 pm, "Radoulov, Dimitre" <cichomit...(a)gmail.com> wrote:
> On 14/06/2010 22.47, Radoulov, Dimitre wrote:
>
> > On 14/06/2010 15.47, Atropo wrote:
> >> Hi all, I'm on solaris 5.10 and trying to get several files from
> >> windows server, but with the condition that the files do not have the
> >> extension ".par"
>
> [...]
>
> > perl -MNet::FTP -e'
> > ( $host, $user, $pass ) = @ARGV;
> > $ftp = Net::FTP->new($host) or die "$@\n";
> > $ftp->login( $user, $pass ) or die $ftp->message;
> > $ftp->binary;
> > @files = grep !/\.par/, $ftp->ls;
>
> It should be:
>
> !/\.par$/
>         ^
>
> > $ftp->get($_) for @files;
> > $ftp->quit or die $ftp->message;
> > ' <host> <user> <pass>
>
> Dimitre

Thanks a lot Dimitre, althoug i don't know any perl i'm trying your
suggestion, I'm rtfm but it's overwhelming.
I tried $ftp->cd DIR/OTHERDIR/ANOTHER; and it's failing
Bareword found where operator expected at -e line 6, near "->cd DIR"
(Missing operator before DIR?)

beside this i have a question. in ksh i can get rid off extension
using ${file%.*}. how can i use this or something like in perl to
avoid getting the files associates to '.par' files.

in this list i only want to get the last four files

LOC755225
LOC755225.par
LOC705529
LOC705529.par
LOC776480
LOC776480.par
LOC786253
LOC786219
LOC786210
LOC786202
From: Radoulov, Dimitre on
On 15/06/2010 15.52, Atropo wrote:
> On Jun 14, 4:51 pm, "Radoulov, Dimitre"<cichomit...(a)gmail.com> wrote:
>> On 14/06/2010 22.47, Radoulov, Dimitre wrote:
>>
>>> On 14/06/2010 15.47, Atropo wrote:
>>>> Hi all, I'm on solaris 5.10 and trying to get several files from
>>>> windows server, but with the condition that the files do not have the
>>>> extension ".par"
>>
>> [...]
>>
>>> perl -MNet::FTP -e'
>>> ( $host, $user, $pass ) = @ARGV;
>>> $ftp = Net::FTP->new($host) or die "$@\n";
>>> $ftp->login( $user, $pass ) or die $ftp->message;
>>> $ftp->binary;
>>> @files = grep !/\.par/, $ftp->ls;
>>
>> It should be:
>>
>> !/\.par$/
>> ^
>>
>>> $ftp->get($_) for @files;
>>> $ftp->quit or die $ftp->message;
>>> '<host> <user> <pass>
>>
>> Dimitre
>
> Thanks a lot Dimitre, althoug i don't know any perl i'm trying your
> suggestion, I'm rtfm but it's overwhelming.
> I tried $ftp->cd DIR/OTHERDIR/ANOTHER; and it's failing
> Bareword found where operator expected at -e line 6, near "->cd DIR"
> (Missing operator before DIR?)
>
> beside this i have a question. in ksh i can get rid off extension
> using ${file%.*}. how can i use this or something like in perl to
> avoid getting the files associates to '.par' files.
>
> in this list i only want to get the last four files
>
> LOC755225
> LOC755225.par
> LOC705529
> LOC705529.par
> LOC776480
> LOC776480.par
> LOC786253
> LOC786219
> LOC786210
> LOC786202


You could try something like this:

perl -MNet::FTP -le'
( $host, $user, $pass, $dir ) = @ARGV;
$ftp = Net::FTP->new($host) or die "$@\n";
$ftp->login( $user, $pass ) or die $ftp->message;
$ftp->cwd($dir) or die $ftp->message;
$ftp->binary;
/(.*)\.par$/ and $files_ko{$1} = 1
or push @files, $_
for $ftp->ls;
$files_ko{$_} or $ftp->get($_) for @files;
$ftp->quit or die $ftp->message;
' <host> <user> <user> <dir>



Regards
Dimitre
 |  Next  |  Last
Pages: 1 2 3 4 5
Prev: Launch and exit the browser
Next: Huge mailbox split?