Solved

mkdir() function versus mkdir command

Posted on 2014-12-04
6
142 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
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 500 total points
ID: 40483786
try to redirect the errors to a file:

system("mkdir dir_name > /tmp/mylog 2> /tmp/myerror");
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why VNC doesn't work in Redhat? 11 34
Using init script with Systemd: need help crafting unit file 11 77
Can't See Site After DNS Resolved 7 47
How to learn Linux? 10 42
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now