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?
 
omarfaridConnect With a Mentor Commented:
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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
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
All Courses

From novice to tech pro — start learning today.