| |||||||||||
| |||||||||||
Directory Processing
this example from a Well House Consultants training course
Source code: filer Module: P255
opendir(DH,"."); while ($item = readdir(DH)) { @about = stat($item); printf "%o - ",$about[2]; $when = localtime($about[9]); print ("$when "); print "@about[0,2,9] - $item\n"; } __END__ As illustration of stat - printing out some useful infomatation about the files in a directory, interpretting file permissions and date stamps from the stat report ( which are not provided back in a program user friendly format! ) Sample output: 40755 - Sun Mar 8 06:34:35 2009 234881026 16877 1236494075 - . 40755 - Sat Mar 7 07:00:15 2009 234881026 16877 1236409215 - .. 100644 - Wed Mar 4 16:42:03 2009 234881026 33188 1236184923 - .stuffing.sage.swp 100644 - Sun Mar 8 05:52:14 2009 234881026 33188 1236491534 - al1 100644 - Sun Mar 8 05:51:16 2009 234881026 33188 1236491476 - al2 100644 - Sun Mar 8 05:53:01 2009 234881026 33188 1236491581 - al3 100755 - Sun Mar 8 05:53:38 2009 234881026 33261 1236491618 - allo 100644 - Sun Mar 8 05:56:24 2009 234881026 33188 1236491784 - c1 100644 - Sun Mar 8 05:59:46 2009 234881026 33188 1236491986 - cf 100644 - Sun Mar 8 06:06:04 2009 234881026 33188 1236492364 - cstr 100644 - Sun Mar 8 06:09:52 2009 234881026 33188 1236492592 - demo 100644 - Sun Mar 8 06:10:23 2009 234881026 33188 1236492623 - demo.html 100644 - Sun Mar 8 06:14:14 2009 234881026 33188 1236492854 - diane_horse 100644 - Sun Mar 8 06:18:36 2009 234881026 33188 1236493116 - extras.pm 100644 - Sun Mar 8 06:29:31 2009 234881026 33188 1236493771 - fil_tar 100644 - Sun Mar 8 06:34:34 2009 234881026 33188 1236494074 - filer 100644 - Wed Mar 4 10:05:44 2009 234881026 33188 1236161144 - flipper 100644 - Wed Mar 4 08:12:50 2009 234881026 33188 1236154370 - gdi 100644 - Mon Mar 2 17:22:10 2009 234881026 33188 1236014530 - greet 100644 - Thu Mar 5 11:02:11 2009 234881026 33188 1236250931 - hatter 100644 - Wed Mar 4 11:07:50 2009 234881026 33188 1236164870 - lidem 100644 - Thu Mar 5 15:52:18 2009 234881026 33188 1236268338 - lll1 100644 - Wed Mar 4 15:19:26 2009 234881026 33188 1236179966 - log2 100644 - Wed Mar 4 14:24:36 2009 234881026 33188 1236176676 - logger 100644 - Thu Mar 5 18:05:52 2009 234881026 33188 1236276352 - loglooker 100644 - Wed Mar 4 15:30:27 2009 234881026 33188 1236180627 - onion 100644 - Mon Mar 2 13:12:09 2009 234881026 33188 1235999529 - oops 100644 - Tue Mar 3 12:04:13 2009 234881026 33188 1236081853 - pcode 100644 - Thu Mar 5 14:27:34 2009 234881026 33188 1236263254 - peephole 100644 - Thu Mar 5 13:42:09 2009 234881026 33188 1236260529 - peeps.txt 100644 - Tue Mar 3 08:46:09 2009 234881026 33188 1236069969 - prg 100660 - Fri Mar 6 09:29:18 2009 234881026 33200 1236331758 - self 100644 - Fri Mar 6 11:39:55 2009 234881026 33188 1236339595 - skillstep 100644 - Wed Mar 4 08:40:19 2009 234881026 33188 1236156019 - superls 100644 - Wed Mar 4 10:10:43 2009 234881026 33188 1236161443 - xmas Dorothy:perl grahamellis$ Learn about this subject
This module and example are covered as required on private courses.
Should you wish to cover this example and associated subjects, and you're attending a public course
to cover other topics with us, please see our extra topic program.
Books covering this topic
Yes. We have over 700 books in our library. Books
covering Perl are listed here and when you've selected a
relevant book we'll link you on to Amazon to order.
Other Examples
This example comes from our "this" training module. You'll find a description of the topic and some
other closely related examples on the "this" module index page.
Full description of the source code
You can learn more about this example on the training courses listed on this page,
on which you'll be given a full set of training notes.
Many other training modules are available for download (for limited use) from our download centre under an Open Training Notes License. Other resources
• Our Solutions centre provides a number of longer technical articles.
• Our Opentalk forum archive provides a question and answer centre. • The Horse's mouth provides a daily tip or thought. • Further resources are available via the resources centre. • All of these resources can be searched through through our search engine • And there's a global index here. Web site author
Purpose of this website
This is a sample program, class demonstration or answer from a
training course. It's main purpose
is to provide an after-course service to customers who have attended our
public private or
on site courses, but the examples are made
generally available under conditions described below.
Conditions of use
Past attendees on our training courses are welcome to use individual
examples in the course of their programming, but must check
the examples they use to ensure that they are suitable for their
job. Remember that some of our examples show you how not to do
things - check in your notes. Well House Consultants take no responsibility
for the suitability of these example programs to customer's needs.
This program is copyright Well House Consultants Ltd. You are forbidden from using it for running your own training courses without our prior written permission. See our page on courseware provision for more details. Any of our images within this code may NOT be reused on a public URL without our prior permission. For Bona Fide personal use, we will often grant you permission provided that you provide a link back. Commercial use on a website will incur a license fee for each image used - details on request. |
| ||||||||||
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho PAGE: http://www.wellho.net/resources/ex.php4 • PAGE BUILT: Sun Oct 11 14:50:09 2020 • BUILD SYSTEM: JelliaJamb |