<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: perl ..with date in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007100#M98904</link>
    <description>my@files=sort{-M$a&amp;lt;=&amp;gt;-M$b}glob"dir/*"';&lt;BR /&gt;&lt;BR /&gt;(swap $a and $b in the sort)&lt;BR /&gt;&lt;BR /&gt;see&lt;BR /&gt;&lt;BR /&gt;# perldoc -f sort&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn [ don't forget to rate the answers ]</description>
    <pubDate>Thu, 05 Oct 2006 16:47:11 GMT</pubDate>
    <dc:creator>H.Merijn Brand (procura</dc:creator>
    <dc:date>2006-10-05T16:47:11Z</dc:date>
    <item>
      <title>perl ..with date</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007090#M98894</link>
      <description>Hi All,(ladies and gentlemen :))&lt;BR /&gt;  i need help in writing the perl script which checks whether a directory exists or not  and read the files in a directory and sort the files according to the date they are created &lt;BR /&gt; Thanks in Advance&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Oct 2006 11:55:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007090#M98894</guid>
      <dc:creator>Abdul khadeer_1</dc:creator>
      <dc:date>2006-10-05T11:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: perl ..with date</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007091#M98895</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;- creation date is of no means at a UNIX like system and not recorded anyway&lt;BR /&gt;- why perl?&lt;BR /&gt;- for modification time you can use in a shell something like this, to get the latest m-time first:&lt;BR /&gt;&lt;BR /&gt;d=/path/to/dir&lt;BR /&gt;[ -d $d ] &amp;amp;&amp;amp; ls -t $d&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Thu, 05 Oct 2006 12:23:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007091#M98895</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-10-05T12:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: perl ..with date</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007092#M98896</link>
      <description>it is requirement in my perl program.</description>
      <pubDate>Thu, 05 Oct 2006 13:21:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007092#M98896</guid>
      <dc:creator>Abdul khadeer_1</dc:creator>
      <dc:date>2006-10-05T13:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: perl ..with date</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007093#M98897</link>
      <description>Hi Abdul,&lt;BR /&gt;&lt;BR /&gt;#!/usr/contrib/bin/perl&lt;BR /&gt;$dir="/path/to/dir/";&lt;BR /&gt;if (-d $dir)&lt;BR /&gt;{&lt;BR /&gt;  system("ls -1t $dir");&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;;-)&lt;BR /&gt;&lt;BR /&gt;PCS</description>
      <pubDate>Thu, 05 Oct 2006 13:34:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007093#M98897</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2006-10-05T13:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: perl ..with date</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007094#M98898</link>
      <description>my @files = -d $dir ? sort { -C $a &amp;lt;=&amp;gt; -C $b } glob "$dir/*" : ();&lt;BR /&gt;&lt;BR /&gt;Like that?&lt;BR /&gt;&lt;BR /&gt;BTW You didn't specify&lt;BR /&gt;- if you wanted to sort ascending or descending&lt;BR /&gt;- if the directory should be descended in&lt;BR /&gt;- if files starting with a "." should be included&lt;BR /&gt;&lt;BR /&gt;Alternate way, descending and reversing the sort:&lt;BR /&gt;&lt;BR /&gt;use File::Find;&lt;BR /&gt;my @files;&lt;BR /&gt;find(sub{-f&amp;amp;&amp;amp;push@files,$File::Find::name},$dir);&lt;BR /&gt;@files = sort { -C $b &amp;lt;=&amp;gt; -C $a } @files;&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Thu, 05 Oct 2006 13:52:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007094#M98898</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2006-10-05T13:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: perl ..with date</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007095#M98899</link>
      <description>by calling system we are calling unix utility .what if i have the same code in windows :)</description>
      <pubDate>Thu, 05 Oct 2006 13:55:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007095#M98899</guid>
      <dc:creator>Abdul khadeer_1</dc:creator>
      <dc:date>2006-10-05T13:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: perl ..with date</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007096#M98900</link>
      <description>Then my examples will still work.&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Thu, 05 Oct 2006 14:31:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007096#M98900</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2006-10-05T14:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: perl ..with date</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007097#M98901</link>
      <description>i want sort according to the time it is modified</description>
      <pubDate>Thu, 05 Oct 2006 15:12:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007097#M98901</guid>
      <dc:creator>Abdul khadeer_1</dc:creator>
      <dc:date>2006-10-05T15:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: perl ..with date</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007098#M98902</link>
      <description>Well, you said *Change time* in the original question.&lt;BR /&gt;&lt;BR /&gt;For modification time sorting, just use -M&lt;BR /&gt;&lt;BR /&gt;Sort, newest last:&lt;BR /&gt;&lt;BR /&gt;my@files=sort{-M$b&amp;lt;=&amp;gt;-M$a}glob"dir/*"';&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Oct 2006 15:48:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007098#M98902</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2006-10-05T15:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: perl ..with date</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007099#M98903</link>
      <description>for newest first the tag would be</description>
      <pubDate>Thu, 05 Oct 2006 15:56:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007099#M98903</guid>
      <dc:creator>Abdul khadeer_1</dc:creator>
      <dc:date>2006-10-05T15:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: perl ..with date</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007100#M98904</link>
      <description>my@files=sort{-M$a&amp;lt;=&amp;gt;-M$b}glob"dir/*"';&lt;BR /&gt;&lt;BR /&gt;(swap $a and $b in the sort)&lt;BR /&gt;&lt;BR /&gt;see&lt;BR /&gt;&lt;BR /&gt;# perldoc -f sort&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn [ don't forget to rate the answers ]</description>
      <pubDate>Thu, 05 Oct 2006 16:47:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007100#M98904</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2006-10-05T16:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: perl ..with date</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007101#M98905</link>
      <description>&lt;!--!*#--&gt;Though it could hardly be solved much terser than what Procura gave you,&lt;BR /&gt;I think the terseness has a few drawbacks.&lt;BR /&gt;First afaik Perl is using the csh globbing mechanism when either &lt;FILEGLOBPATTERN&gt; or glob() is called.&lt;BR /&gt;This means that if you have many, or long named files (caveat long paths) in the directory your script may be susceptible to exhaust the No. of chars limited by the OS (e.g. getconf ARG_MAX).&lt;BR /&gt;Besides the single asteriks would not expand the "hidden" dot files.&lt;BR /&gt;To include them as well (without also catching the current and parent dir) you would have to use some arcane shell globbing pattern like such if you want to stick with glob() (or cast it through a Perl grep()).&lt;BR /&gt;    &lt;BR /&gt;$ perl -e 'printf"%d files in /tmp\n",scalar@{[glob"/tmp/* /tmp/.[!.]*"]}'&lt;BR /&gt;290 files in /tmp&lt;BR /&gt;   &lt;BR /&gt;For large amounts of files or long paths you are probably better off with additional opendir(), readdir(), closedir().&lt;BR /&gt;If you need to recurse into subdirs as well combine those in a Find::File callback.&lt;BR /&gt; &lt;BR /&gt;&lt;/FILEGLOBPATTERN&gt;</description>
      <pubDate>Fri, 06 Oct 2006 07:43:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007101#M98905</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2006-10-06T07:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: perl ..with date</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007102#M98906</link>
      <description>Ralph's answer is completely correct, which is why I included a File::Find example earlier in this thread.&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Fri, 06 Oct 2006 07:46:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007102#M98906</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2006-10-06T07:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: perl ..with date</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007103#M98907</link>
      <description>thanks all of you ,for helping me out</description>
      <pubDate>Fri, 06 Oct 2006 08:23:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-with-date/m-p/5007103#M98907</guid>
      <dc:creator>Abdul khadeer_1</dc:creator>
      <dc:date>2006-10-06T08:23:46Z</dc:date>
    </item>
  </channel>
</rss>

