mkdir

Recursive mkdir() system call on Unix

☆樱花仙子☆ 提交于 2019-12-17 07:11:13
问题 After reading the mkdir(2) man page for the Unix system call with that name, it appears that the call doesn't create intermediate directories in a path, only the last directory in the path. Is there any way (or other function) to create all the directories in the path without resorting to manually parsing my directory string and individually creating each directory ? 回答1: There is not a system call to do it for you, unfortunately. I'm guessing that's because there isn't a way to have really

PHP mkdir or chmod 0777 doesn't work

旧时模样 提交于 2019-12-13 19:13:13
问题 I have a small script that create a directory for a user who registers an account on my site. This director is used to store images in that they upload. When I use mkdir() with permissions of 0777, the directory is created under the users name, but the permissions stay as 0755. I have tried a few different ways to do this, as follows; $path = path/to/directory/and/filename $old = umask(0); mkdir($path,0777); umask($old); also; $path = path/to/directory/and/filename/ mkdir($path, 0777, true);

create multiple folders using existing file names in linux

≯℡__Kan透↙ 提交于 2019-12-13 04:55:13
问题 i have downloaded several pdf files(with various names) and stored them in a specific directory (for example, Downloads/directory1 ). i would like to create folders to store these files under the same directory, using the names of the original files, but without the extension pdf. for example, for a file named maths.pdf , i want to create the folder maths and store the pdf in it. i made several attempts creating a script using commands as basename and for , but i didn't have any luck. 回答1:

Create dynamically multiple subdirectory into folder using multiple input type textboxes in For Loop?

故事扮演 提交于 2019-12-13 04:43:01
问题 i need help to solve how to create dynamically multiple folders using input type textbox ? i can create only single dynamically subdirectory into the folder but i want to multiple subfolder when multiple input type textbox are display? problem is that i can create only one subdirectory into the folder at time using input type textboxes i have already create multiple textbox using javascript? Php Code //creating a folder $folder = implode($_POST['folder']); for($i=0; $i<$folder; $i++) {

Writing to file and mkdir race conditions C

天大地大妈咪最大 提交于 2019-12-13 04:07:24
问题 I made a function that tries to create a directory, and then write a simple file: buffer = "Hello world!"; string url = "a/b/c/d/"; string tmp = ""; string done = ""; while((tmp = GetBaseDir(url)).compare("")!=0){ done+=tmp; mkdir(done.c_str(), 0777); } // GetBaseDir returns "a/", and changes url to "b/c/d/" ofstream file; file.open((url+"file.txt").c_str(),ios::trunc); file << buffer; file.close(); As you can see, it only tries, if there is a failure it just keeps going on. I read that 'open

variable name expansion not working inside target in GNU Makefile

自古美人都是妖i 提交于 2019-12-13 03:55:57
问题 I am trying to create a directory inside target based on a rule but for some reason the variable is not getting expanded i.e., $(OUT_DIR) is blank and mkdir -p does not work. Here is the code target_%: /home/user/%/.file : file.c export OUT_DIR = /home/user/$* ; \ mkdir -p $(OUT_DIR) ;\ . . . After making the changes suggested by @Beta, here is how the code looks like target_%: /home/user/%/.file : file.c export OUT_DIR=/home/user/$* ; \ mkdir -p $${OUT_DIR} ;\ cd $${OUT_DIR} ; \ ln -s /home

MkDir Failed creating directory PHP

☆樱花仙子☆ 提交于 2019-12-13 03:22:57
问题 I am trying to create a directory using PHP this works: <?php $uid = "user_615"; $thisdir = getcwd(); if(mkdir($thisdir ."/userpics/" . $uid , 0777)) { echo "Directory has been created successfully..."; } else { echo "Failed to create directory..."; } ?> but this does not work <?php session_start(); $uid = $_SESSION['username']; $thisdir = getcwd(); if(mkdir($thisdir ."/userpics/" . $uid , 0777)) { echo "Directory has been created successfully..."; } else { echo "Failed to create directory...

Creating new folders if they don't exist for fopen

浪子不回头ぞ 提交于 2019-12-13 01:41:34
问题 I have a C++ program that takes user input for fopen in order to initiate a file write. Could someone help me find a function which will return a FILE* and use the Windows specific version of mkdir in order to create the folder structure for fopen to never fail to open a new file in the specified location because one of the folders does not exist. Thanks a bunch! 回答1: there's a method MakeSureDirectoryPathExists in the windows API, declared in dbghelp.h. It recursively creates directories, so

Is mkdir still atomic? (Windows 7 filesystems mounted on SAN)

試著忘記壹切 提交于 2019-12-12 10:50:01
问题 We have some old applications that communicate via directory-based queues. Each item in the queue is a file, and there's a header file that maintains an ordered list of the filenames for the items in the queue. Naturally, this old code needs to lock the queue while items are pushed and popped. What it's doing is creating a lock subdirectory, on the assumption that mkdir() is an atomic operation - if multiple processes attempt to create a directory, only one of them is going to succeed. One of

Bash unable to create directory

元气小坏坏 提交于 2019-12-12 04:59:11
问题 In docker, I want to copy a file README.md from an existing directory /opt/ibm/labfiles to a new one /input/tmp . I try this hdfs dfs -put /opt/ibm/labfiles/README.md input/tmp to no effect, because there seems to be no /input folder in the root. So I try to create it: hdfs dfs -mkdir /input mkdir:'/input': File exists However, when I ls, there is no input file or directory How can I create a folder and copy the file? Thank you!! 回答1: Please try hdfs dfs -ls / if you want to see there is an