mkdir() function versus mkdir command

Hello,

system("mkdir dir_name");

Open in new window

does not create any folder but,
mkdir("dir_name", 0770);

Open in new window

successfully creates

Regards,
Nusrat
Nusrat NuriyevAsked:
Who is Participating?
 
omarfaridCommented:
try to redirect the errors to a file:

system("mkdir dir_name > /tmp/mylog 2> /tmp/myerror");
0
 
omarfaridCommented:
Are you capturing error messages? Are you using full path name while calling mkdir?
0
 
Nusrat NuriyevAuthor Commented:
Are you using full path name while calling mkdir?
Sure.

how to capture?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
TintinCommented:
As per the system documentation, use:

@args = ("mkdir", "/path/to/dir");
system(@args) == 0 or die "system @args failed: $?"

Open in new window

0
 
ozoCommented:
Is this written in Perl or C?
0
 
TintinCommented:
Whoops.  Didn't see the topics.   My last post is for Perl only.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.