# I appreciate the way you guys help people here.
# If possible please also briefly explain your code so that i could know what the code actually means.
# Thanks a lot.
Q 1: How can i get the extension of a file ($file)?
e.g. $file could be anything me.jpg, one.exe, two.psd etc.
i only need the extension.
Q2: Sizes and number of files and sub-directories.
Let me explain what i actually need.
Suppose I have a main directory (maindir).
maindir has sub-directories (sub-dirA, sub-dirB, .....)
Every sub-directory could have further subdirecties (sub-subdirA1, sub-subdirA2, sub-subdirB1, ........)
These sub-subdirectories have files in them.
Note: please note that subdirectories cant have files in them. only sub-subdirectories have files.
I need to find: the total number of sub-directories. total number of sub-subdirectories. total number of files in all the sub-subdirectories and total sizes (combined sizes) of all the files.
Q3: I need to build a list of recently uploaded files.
I have all the info like, file name ($filename), user who uploaded the file ($username), time and date ($timendate), sub-subdirectory where the file is uploaded ($subdirectory, $sub-subdir). I need to save this info of $x number of recently uploaded files in record.txt
$x could be any number defined by the programmer in the code.

Q4: And then i need to seperately retrieve info of the uploaded files.
The last 10 uploaded files were abc.txt, tnt.pl,.....

Thanks again.
Ahsan Balouch

In reply to Questions related to files and directories by BalochDude

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.