Hello everyone! I have been lurking around here for quite some time and have now decided that there is no time like the present to start learning perl. Anywho, I am working on a perl script that's only purpose at the moment, is to create a few directories and a couple of zero byte files, and change their permissions.

Below is the code that I have written so far:

#!/opt/bin/perl -w use strict; use Getopt::Long; my $clientname; my $fdgid; GetOptions ("clientname" => \$clientname, # client name for direc +tory "fdgid" => \$fdgid); # client Filedrive GID + number mkdir "/home/jlk/tmp/data/stuff/archive/$clientname",0002; mkdir "/home/jlk/tmp/data/stuff/archive/$clientname/tmp",0002; mkdir "/home/jlk/tmp/data/stuff/archive/$clientname/not_proc",0002; mkdir "/home/jlk/tmp/data/stuff/archive/$clientname/enc_arch_files",00 +02; mkdir "/home/jlk/tmp/data/stuff/archive/$clientname/enc_arch_files/inc +oming",0002; mkdir "/home/jlk/tmp/data/stuff/$fdgid/users/incoming",0002; mkdir "/home/jlk/tmp/data/stuff/$fdgid/users/incoming/$clientname",000 +2; mkdir "/home/jlk/tmp/data/stuff/$fdgid/users/outgoing",0002; mkdir "/home/jlk/tmp/data/stuff/$fdgid/users/outgoing/history",0022; system ("touch /home/jlk/tmp/data/stuff/archive/$clientname/$clientnam +e.log"); system ("touch /home/jlk/tmp/data/stuff/archive/$clientname/${clientna +me}_ack.log"); chmod 0111, '/home/jlk/tmp/data/stuff/archive/$clientname/$clientname. +log'; chmod 0111, '/home/jlk/tmp/data/stuff/archive/$clientname/${clientname +}_ack.log';

In the above code, the directories "/home/jlk/tmp/data/stuff/archive" and "/home/jlk/tmp/data/stuff/$fdgid/users" already exist. The permissions are set to 777(wide open). Also, I am running this on a Solaris 9 system running Perl v5.8.0.


When I run the script in its present state as shown above, I get the following output:

/home/jlk: ./ecgsetup.pl --clientname testing --fdgid G7778888
touch: /home/jlk/tmp/data/stuff/archive/1/1.log cannot stat
touch: /home/jlk/tmp/data/stuff/archive/1/1_ack.log cannot stat


Now, in running this script, the directory "/home/jlk/tmp/data/stuff/archive/testing" should have been created, but instead is called "/home/jlk/tmp/data/stuff/archive/1". The directory "1" has permissions d---------. Also, the directory "/home/jlk/tmp/data/stuff/users/G7778888" is not even created.

I would love to know the error of my ways, if someone could just point it out. Thank you much in advance for any and all assistance.


Regards,
jlk

Seasame street was brought to you today by the letters M, I and T and the number 3.1415926535897932384626433832795


In reply to Need help with script to create directories by jlk

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.