Prev: Launch and exit the browser
Next: Huge mailbox split?
From: Atropo on 15 Jun 2010 10:52 On Jun 15, 10:27 am, "Radoulov, Dimitre" <cichomit...(a)gmail.com> wrote: > 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 I really appreciate your help Dimitre. it runs but it brought everything. i run as it, 'coz i don't understand any after binary command
From: Radoulov, Dimitre on 15 Jun 2010 11:03 On 15/06/2010 16.52, Atropo wrote: > On Jun 15, 10:27 am, "Radoulov, Dimitre"<cichomit...(a)gmail.com> > wrote: >> 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; [...] >>> 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> [...] > it runs but it brought > everything. i run as it, 'coz i don't understand any after binary > command Hm, could you post the output of the following script: perl -MNet::FTP -e' ( $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; for ($ftp->ls) { printf "fname ->%s<-\n", $_; /(.*)\.par$/ and printf "\$1 -->%s<--\n", $1; } $ftp->quit or die $ftp->message; ' <host> <user> <pass> <dir> Regards Dimitre
From: Atropo on 15 Jun 2010 11:47 On Jun 15, 11:03 am, "Radoulov, Dimitre" <cichomit...(a)gmail.com> wrote: > On 15/06/2010 16.52, Atropo wrote: > > > > > On Jun 15, 10:27 am, "Radoulov, Dimitre"<cichomit...(a)gmail.com> > > wrote: > >> 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; > > [...] > > > > >>> 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> > > [...] > > > it runs but it brought > > everything. i run as it, 'coz i don't understand any after binary > > command > > Hm, > > could you post the output of the following script: > > perl -MNet::FTP -e' > ( $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; > for ($ftp->ls) { > printf "fname ->%s<-\n", $_; > /(.*)\.par$/ and printf "\$1 -->%s<--\n", $1; > } > $ftp->quit or die $ftp->message; > ' <host> <user> <pass> <dir> > > Regards > Dimitre changed par with tag fname ->LOC758523948755225<- fname ->LOC758523948755225.tag<- $1 -->LOC758523948755225<-- fname ->LOC759375948805529<- fname ->LOC759375948805529.tag<- $1 -->LOC759375948805529<-- fname ->LOC760305248876480<- fname ->LOC760305248876480.tag<- $1 -->LOC760305248876480<-- fname ->LOC762093448986253<- fname ->LOC762093848986219<- fname ->LOC762093948986210<-
From: Atropo on 15 Jun 2010 14:08 On Jun 15, 11:03 am, "Radoulov, Dimitre" <cichomit...(a)gmail.com> wrote: > On 15/06/2010 16.52, Atropo wrote: > > > > > On Jun 15, 10:27 am, "Radoulov, Dimitre"<cichomit...(a)gmail.com> > > wrote: > >> 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; > > [...] > > > > >>> 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> > > [...] > > > it runs but it brought > > everything. i run as it, 'coz i don't understand any after binary > > command > > Hm, > > could you post the output of the following script: > > perl -MNet::FTP -e' > ( $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; > for ($ftp->ls) { > printf "fname ->%s<-\n", $_; > /(.*)\.par$/ and printf "\$1 -->%s<--\n", $1; > } > $ftp->quit or die $ftp->message; > ' <host> <user> <pass> <dir> > > Regards > Dimitre Sorry dimitre, it works fine, was a typo of mine. but i still don't understand /(.*)\.tag$/ and $files_ko{$1} = 1 or push @files, $_ for $ftp->ls; $files_ko{$_} or $ftp->get($_) for @files;
From: Atropo on 15 Jun 2010 14:31 On Jun 15, 2:08 pm, Atropo <lxvasq...(a)gmail.com> wrote: > On Jun 15, 11:03 am, "Radoulov, Dimitre" <cichomit...(a)gmail.com> > wrote: > > > > > On 15/06/2010 16.52, Atropo wrote: > > > > On Jun 15, 10:27 am, "Radoulov, Dimitre"<cichomit...(a)gmail.com> > > > wrote: > > >> 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; > > > [...] > > > >>> 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> > > > [...] > > > > it runs but it brought > > > everything. i run as it, 'coz i don't understand any after binary > > > command > > > Hm, > > > could you post the output of the following script: > > > perl -MNet::FTP -e' > > ( $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; > > for ($ftp->ls) { > > printf "fname ->%s<-\n", $_; > > /(.*)\.par$/ and printf "\$1 -->%s<--\n", $1; > > } > > $ftp->quit or die $ftp->message; > > ' <host> <user> <pass> <dir> > > > Regards > > Dimitre > > Sorry dimitre, it works fine, was a typo of mine. but i still > don't understand > > /(.*)\.tag$/ and $files_ko{$1} = 1 > or push @files, $_ > for $ftp->ls; > $files_ko{$_} or $ftp->get($_) for @files; if i want to delete the remote files i have transfer . could I use @files or do all again like /(.*)\.tag$/ and $files_ko{$1} = 1 or push @files, $_ for $ftp->ls; $files_ko{$_} or $ftp->delete($_) for @files; <= only changed the "get" for "delete"
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: Launch and exit the browser Next: Huge mailbox split? |