RE: how to check if a dir exists if not create it?

2002-10-10 Thread Nikola Janceski
use File::Path; mkpath(/storage/systbl/, 0, 0777) || die $!\n; in accordance with the prophecy. -Original Message- From: loan tran [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 10, 2002 5:26 PM To: [EMAIL PROTECTED] Subject: how to check if a dir exists if not create it?

RE: how to check if a dir exists if not create it?

2002-10-10 Thread Timothy Johnson
Check out the file test man pages: perldoc -f -x -Original Message- From: loan tran [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 10, 2002 2:26 PM To: [EMAIL PROTECTED] Subject: how to check if a dir exists if not create it? mkdir (/storage/systbl/) || die $!\n; The code above

Re: how to check if a dir exists if not create it?

2002-10-10 Thread Steve Grazzini
Loan Tran [EMAIL PROTECTED] wrote: mkdir (/storage/systbl/) || die $!\n; The code above does not check if the dir exist. Can you modify it please. Thanks. You can check whether a directory exists with the -e and -d file test operators. $ perldoc -f -X But as soon as you write code like:

Re: how to check if a dir exists if not create it?

2002-10-10 Thread david
Loan Tran wrote: mkdir (/storage/systbl/) || die $!\n; The code above does not check if the dir exist. Can you modify it please. Thanks. try: #!/usr/bin/perl -w use strict; use File::Path; my $dir = '/a/long/not/existing/dir'; mkpath($dir) || die no permission to $dir?; print done\n

Re: how to check if a dir exists if not create it?

2002-10-10 Thread loan tran
Thank you all for your reply. I greatly appreciate your help. Loan --- Steve Grazzini [EMAIL PROTECTED] wrote: Loan Tran [EMAIL PROTECTED] wrote: mkdir (/storage/systbl/) || die $!\n; The code above does not check if the dir exist. Can you modify it please. Thanks. You can check