Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a folder 2

Status
Not open for further replies.

JimJx

Technical User
Joined
Feb 16, 2001
Messages
202
Location
US
I have the following script:

Code:
#!/usr/bin/perl

print "Content-type: text/html\n\n";

use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
use CGI qw(:standard);
print header();
warningsToBrowser(1);

# SET A VARIABLE
my $count = 1;
my $userName = "";
my $password = "0000";
my $newFolder = "/var/[URL unfurl="true"]www/htdocs/members/";[/URL]

# RUN A WHILE LOOP
while ($count <= 100) {
	$userName = "JRC" . $count;
	$password++;
	# PRINT THE VARIABLE AND AN HTML LINE BREAK
	print "$userName : $password<br />";
	
	mkdir "$newFolder" . "$userName", 0755;
	
	# INCREMENT THE VARIABLE EACH TIME
	$count ++;
}
{/code]

Right now, it is (obviously) very simple.  This is the entire script that I am working with right now.

So the question is why isn't the folder being created? I have checked all permissions and everything looks correct.

Any help appreciated.

Jim
 
try:

Code:
mkdir("$newFolder$userName",0755) or die "Can't mkdir '$newFolder$userName': $!";

and see what error it echos if any.
 
That did it, thanks Kevin.

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top