[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Sheflug] Slightly OT :perl file exists test



Thanks to everyone that sent in the code and I apologise for not looking a)
on google and b) on pageresource first.

The perl docs I find very useful if you already know what command you want
to use but not so useful if you don't know which command to use.

Is there any benefit to using -e (file exists ) over  -f (file is a plain
file (what is a plain file?)?

Which leads me on to my next question (I've googled and pageresourced this
time) which is:

If I test the file and it doesn't exist is there a quick and easy way of
creating the directory structure the file is in if the directories don't
exist as well, like a
mkdir --parents /home/httpd/cgi-bin/myscripts/newscripts/currentscripts

when only /home/httpd/cgi-bin exists.
Can all of myscripts/newscripts/currnetscripts  can be created in one go in
perl?

If I test for ./myscripts/newscripts/currnetscripts/thisscript.pl and it
doesn't exist I want to create a link that will run a script to create the
directory structure and an empty file called thisscript.pl and then call
another script to allow the editing of the file.

Thanks
Chris Johnson
(No not that one, the other one!)
(running SUSE 9, 512MB PIII 600 (ish))

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.677 / Virus Database: 439 - Release Date: 04/05/2004


___________________________________________________________________

Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html

  GNU the choice of a complete generation.