Solved

mkdir() function versus mkdir command

Posted on 2014-12-04
6
148 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

730 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