RE: Creating a directory tree
$mode = 0777; mkdir ("C:\TEST1", $mode); mkdir ("C:\TEST1\FOLDER1", $mode); mkdir ("C:\TEST1\FOLDER2", $mode); mkdir ("C:\TEST1\FOLDER3", $mode); mkdir ("C:\TEST1\FOLDER4", $mode); mkdir ("C:\TEST1\FOLDER5", $mode); -Original Message- From: Roee Rubin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 24, 2000 2:45 PM To: Perl-Win32-Users Mailing List Cc: Chann An Subject:Creating a directory tree Hello, What is the best method to create a directory tree? Roee Rubin [EMAIL PROTECTED] --- You are currently subscribed to perl-win32-users as: [EMAIL PROTECTED] To unsubscribe, forward this message to [EMAIL PROTECTED] For non-automated Mailing List support, send email to [EMAIL PROTECTED] --- You are currently subscribed to perl-win32-users as: [archive@jab.org] To unsubscribe, forward this message to [EMAIL PROTECTED] For non-automated Mailing List support, send email to [EMAIL PROTECTED]
Re: Creating a directory tree
Carl Campbell wrote: > $mode = 0777; > mkdir ("C:\TEST1", $mode); > mkdir ("C:\TEST1\FOLDER1", $mode); > mkdir ("C:\TEST1\FOLDER2", $mode); > mkdir ("C:\TEST1\FOLDER3", $mode); > mkdir ("C:\TEST1\FOLDER4", $mode); > mkdir ("C:\TEST1\FOLDER5", $mode); This creates a six directories under drive C's current directory: TEST1 and TEST1FOLDER1 to TEST1FOLDER5 (since "\F" eq "F"; escaping F returns an F). If you had used lowercase, it would be even more fun; the directories would be est1 and est1older1 to est1older5 (since "\f" is a formfeed character, also known as ^L or Ctrl-L or "\cL"). Moral of the story: in double-quoted strings, use double backslashes (e.g. "C:\\TEST1\\FOLDER5") or, even better, forward slashes ("C:/test1/folder5"), which work just fine for Perl system calls such as mkdir() or open(). Cheers, Philip --- You are currently subscribed to perl-win32-users as: [archive@jab.org] To unsubscribe, forward this message to [EMAIL PROTECTED] For non-automated Mailing List support, send email to [EMAIL PROTECTED]
RE: Creating a directory tree
Here is a snippet of code that will iterate through the directories and print a table of links.. You can adapt it for your use...I am working on one that will produce a web page.. I will post it when ready... #!/usr/bin/perl use File::Find; $x = ; chomp ($x); finddepth(\&getfile,$x); print "program completed"; sub getfile { return if (/\.\./); print $File::Find::name,"\n"; } On 24 May 00, at 15:10, Carl Campbell wrote: From: Carl Campbell <[EMAIL PROTECTED]> To: "Perl-Win32-Users Mailing List" <[EMAIL PROTECTED]> Copies to: Chann An <[EMAIL PROTECTED]> Subject:RE: Creating a directory tree Date sent: Wed, 24 May 2000 15:10:38 -0700 Send reply to: Carl Campbell <[EMAIL PROTECTED]> > $mode = 0777; > mkdir ("C:\TEST1", $mode); > mkdir ("C:\TEST1\FOLDER1", $mode); > mkdir ("C:\TEST1\FOLDER2", $mode); > mkdir ("C:\TEST1\FOLDER3", $mode); > mkdir ("C:\TEST1\FOLDER4", $mode); > mkdir ("C:\TEST1\FOLDER5", $mode); > > > -Original Message- > From: Roee Rubin [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, May 24, 2000 2:45 PM > To: Perl-Win32-Users Mailing List > Cc: Chann An > Subject: Creating a directory tree > > Hello, > > What is the best method to create a directory tree? > > Roee Rubin > [EMAIL PROTECTED] > > > --- > You are currently subscribed to perl-win32-users as: [EMAIL PROTECTED] > To unsubscribe, forward this message to > [EMAIL PROTECTED] > For non-automated Mailing List support, send email to > [EMAIL PROTECTED] > > --- > You are currently subscribed to perl-win32-users as: [EMAIL PROTECTED] > To unsubscribe, forward this message to > [EMAIL PROTECTED] > For non-automated Mailing List support, send email to > [EMAIL PROTECTED] > > --- You are currently subscribed to perl-win32-users as: [archive@jab.org] To unsubscribe, forward this message to [EMAIL PROTECTED] For non-automated Mailing List support, send email to [EMAIL PROTECTED]