hiii

hiii

am 09.07.2011 13:54:01 von Narasimha Madineedi

--000e0ce04940262c2f04a7a19b0b
Content-Type: text/plain; charset=ISO-8859-1

hi all,
any net::ftp commands to get latest file from the directory.

--
Regards,
Narasimha Madineedi

--000e0ce04940262c2f04a7a19b0b--

Re: hiii

am 09.07.2011 14:29:14 von Feng He

2011/7/9 Narasimha Madineedi :
> hi all,
> any net::ftp commands to get latest file from the directory.
>

won't "ls -ltr" sort the files by date?

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: hiii

am 10.07.2011 19:23:40 von Narasimha Madineedi

--000e0ce04940e9aa7f04a7ba5376
Content-Type: text/plain; charset=ISO-8859-1

hii i tried ls -ltr but it doesnt work....can u suggest me someother command

On Sat, Jul 9, 2011 at 5:59 PM, Feng He wrote:

> 2011/7/9 Narasimha Madineedi :
> > hi all,
> > any net::ftp commands to get latest file from the directory.
> >
>
> won't "ls -ltr" sort the files by date?
>



--
Regards,
Narasimha Madineedi

--000e0ce04940e9aa7f04a7ba5376--

Re: hiii

am 11.07.2011 09:25:34 von Sandip Bhattacharya

On Sat, Jul 09, 2011 at 05:24:01PM +0530, Narasimha Madineedi wrote:
> hi all,
> any net::ftp commands to get latest file from the directory.
>

You have the hard work yourself:
1. Either use the $ftp->dir() function to get the timestamps, parse it
and find out the latest. A bit unreliable.
2. Better is to use $ftp->ls() to get the list of files, and for each
file, use $ftp->mdtm() to get the modification time, and pick the
latest. mdtm() doesn't work with directories apparently in my ftp
server, so it is useful to skip entries when it doesn't return a
value.

- Sandip


--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/