Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

mkdir() function versus mkdir command

Posted on 2014-12-04
6
Medium Priority
?
171 Views
Last Modified: 2014-12-20
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
0
Comment
Question by:Nusrat Nuriyev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 40

Expert Comment

by:omarfarid
ID: 40480827
Are you capturing error messages? Are you using full path name while calling mkdir?
0
 

Author Comment

by:Nusrat Nuriyev
ID: 40482444
Are you using full path name while calling mkdir?
Sure.

how to capture?
0
 
LVL 40

Accepted Solution

by:
omarfarid earned 1500 total points
ID: 40483786
try to redirect the errors to a file:

system("mkdir dir_name > /tmp/mylog 2> /tmp/myerror");
0
Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

 
LVL 48

Expert Comment

by:Tintin
ID: 40485916
As per the system documentation, use:

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

Open in new window

0
 
LVL 84

Expert Comment

by:ozo
ID: 40485960
Is this written in Perl or C?
0
 
LVL 48

Expert Comment

by:Tintin
ID: 40486052
Whoops.  Didn't see the topics.   My last post is for Perl only.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question