FAQ Database Discussion Community


Creating a directory in “/var/log/” using C in Linux

c,linux,mkdir
I need to create a directory in /var/log using a C program which does NOT run with superuser rights. This linked question didn't help me! I understand that the file permissions of /var/log does not allow us to write in it nor do I want to change it. I use...

Connect to Server via PHP and Write File

php,ftp,mkdir,ftps
I am trying to connect to a server via php and write a PDF file to a folder that I dynamically create. This is the code I am using: <?php $ftp_server = "[server ip]"; $ftp_user_name = "[username]"; $ftp_user_pass = "[password]"; // set up basic ssl connection $conn_id = ftp_connect($ftp_server); //...

Create new folder/file based on time/date

loops,excel-vba,mkdir
so I'm trying to expand a program where it saves reports, exports them as a pdf, and saves. I've got it to where it can organize the pdf saves into folders by year, and then by month. The issue is, when it comes time for the loop to reach the...

mkdir -pv not verbose

osx,bash,mkdir
If I run mkdir -pv, the -p works, but I do not get verbose output; however, if I run just mkdir -v, the verbose output appears as expected. Also potentially of note, the longform of -v does not seem to work at all. From my testing: mkdir -p a/b/c: creates...

How to use PHP mkdir function recursively to skip existing directory and to create new one?

php,mkdir
How to use PHP mkdir function recursively to skip existing directory and to create new one from the string $pathname // works fine if directories don't exist mkdir($root_dir . '/demo/test/one', 0775, true); // It will throw error - Message: mkdir(): File exists mkdir($root_dir . '/demo/test/two', 0775, true); What is the...

How to use curly brackets in npm scripts?

node.js,npm,mkdir
I want to run this simple command in an npm script called prepare_build: ... scripts: { "prepare_build" : "mkdir -p dist/lib/{js,css}" } ... running npm run prepare_build would create a single directory dist/lib/{js,css} whereas running the command in the console would create both dist/lib/js and dist/lib/css. What am I doing...

mkdir on OSX fails with EPERM

c,osx,mkdir,errno
I'm porting a C library to OSX which haven't given me much of a headache until now. In the next function: int createDirectory( char *directory ){ int error; error = mkdir(directory, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); if( error < 0 ){ if( errno != EEXIST ){ return errno;...

PHP unlink() issues

php,permissions,mkdir,unlink
Platform = Mac OS 10.8.5 Hi guys, I'm working on a php/mysql site. When I create a new user, my site creates a series of file folders to house information. My issue is when my user tries to delete his account, it will return a permissions error. I can temporarily...

how to use data variable in mkdir in a linux server with FTP?

php,linux,ftp,mkdir
I need to create a folder in my FTP server, whose name is "YYYY-MM-DD"; I have this variable: slideshow=$(date +"%Y-%m-%d") but I can not use it in FTP with mkdir, since it's a shell variable. I've also tried with echo, and there it works (I have "mkdir 2015-05-25" in a...

Android: mkdir not working

android,mkdir
I want to create MyFolder directory , but cannot to do it, tried different way, but no one working; In Androidmanifest.xml i have: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="my.package" > <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission...

how to solve TAR: CANNOT MKDIR PERMISSION DENIED

permissions,tar,mkdir
File permissions I have a file data.tgz which I want to uncompress. -rw-r--r-- 1 username group 20342951248 mai 18 11:50 data.tgz Directory permissions Directory where file is located drwxrwxr-x 3 username group 4096 juin 1 17:16 directory/ Uncompress When I try to uncompress the file by using the following command:...

Create Directory From Brother Directory

directory,mkdir
My directories have the following Format: Inside the home directory, there are two directories: archive and production. While inside the production directory I want to write a command to make a directory inside the archive directory. Whats the best way to do this? Thanks in advance...

Unaccessible directory created by mkdir in bash script

bash,mkdir
When I use a mkdir in a bash script, I can't access the created directory in terminal. #!/bin/bash date=`date --rfc-3339="date" --date='1 days ago'` date=${date//"-"/""} mkdir -p ⁠$date --verbose touch $date/foe When I use mkdir in a terminal, everything is fine. Here is the error I get : touch: impossible de...

How to create nested directories using Mkdir in Golang?

go,mkdir
I'm trying to create a set of nested directories from a Go executable such as 'dir1/dir2/dir3'. I've succeeded in creating a single directory with this line: os.Mkdir("." + string(filepath.Separator) + c.Args().First(),0777); But I have no idea how to approach creating a predetermined nested set of directories inside of that directory...

Linux shell file. mkdir and pushd commands not doing what I'd like

linux,shell,sh,mkdir
I'm trying to create a directory if it does not exist, and the further down the line, create a log file in that directory. It would be in the current users home directory In pseudocode: If directory "/home/LOGS" does not exist make directory "/home/LOGS" Then whenever a log file is...

is it possible to create new file directory in any specied path with mkdir()

php,mkdir,include-path
i am trying to understand mkdir() function in php.I have specied a path for this function where to create the file.But it is creating a new one in the same directory where my php file lies.my code is mkdir("d://movie/new file"); but on second reload of my php page it says...

Laravel 5: mkdir/Filesystem::makeDirectory with permissions from config

php,laravel,permissions,mkdir
I'm running into an issue this morning with FileSystem::makeDirectory which directly calls mkdir. I'm trying to create a directory recursively pulling the desired mode out of my config like so: $filesystem->makeDirectory($path, config('permissions.directory'), true); config/permissions.php <?php return [ 'directory' => env('PERMISSIONS_DIRECTORY', 0755), 'file' => env('PERMISSIONS_FILE', 0644) ]; .env ... PERMISSIONS_DIRECTORY=0775 PERMISSIONS_FILE=0664...

Mkdir not creating folder - No Errors shown. (PHP) [closed]

php,mkdir
I need some help with mkdir in my .php file. It's not creating the directory. I'm currently running Centos 6.6 web server, I have all folders chmod 755 and owner = Apache. My code is as follows: <?php $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; $rand_dir_name = substr(str_shuffle($chars), 0, 15); mkdir("../userdata/profile_pics/".$rand_dir_name); ?> No error...

Create a directory in WordPress Multisite subsite directory

php,wordpress,copy,mkdir
I am attempting to create a directory in a WordPress Multisite subsite directory. The subsite directory is located at /home/site/site.com/wp-content/uploads/sites/site_id/ where site_id is the actual id# of the subsite. I'm looking to create a directory under the site_id directory, and then add a file to that directory from elsewhere in...

mkdir fails in every way

php,mkdir
Got this error: mkdir(): No such file or directory. This is strange because ofcourse the directory doesn't exists because i want to create it. I checked the rights and its 0777. The folder I tried to create is in: http://www.mysite/uploads/images/ so after folder creation it should look like: http://www.mysite/uploads/images/1 Anyone...

rename images and move the renamed images in newly created directory

php,rename,mkdir
Here i want to create a new directory called c:/xampp/htdocs/haha/tour/ and in the directory i want to move my renamed images .Here ,i managed to create the new directory but can't move and rename my images.How can i solve this problem?? $dir='c:/xampp/htdocs/practice/haha'; $i=1; if(is_dir($dir)){ echo dirname($dir).'</br>'; $file=opendir($dir); while(($data=readdir($file))!==false){ if($data!='.' &&...

Gradle Exec : Why it is not running in configuration phase?

gradle,exec,mkdir
Here is my: build.gradle task makeDirectoryStructure(type:Exec){ description 'Creates directory structure .' commandLine 'mkdir' args '-p' ,'top_dir/sub_dir_1/sub_dir_2' println "This line is printed in configuration phase." } Now, since I haven't used '<<' or< 'doFirst/doLast', I expect mkdir to be executed in configuration phase i.e. whenever the build script is compiled. For...

Batch creation of folders

python,folders,mkdir
I am trying to script a function in which it will creates a list of folders and sub-folders. While my code is as follows, I was wondering if there are any better methods for me to create the sub-folders? (See createFolders function line 5 onwards) Not that the naming of...

Using regular expression search and replace rename on linux with directory creation

regex,linux,replace,rename,mkdir
Take a list of files such as: /home/me/specialfiles/group01subgroup01.xyz /home/me/specialfiles/group01subgroup01.abc /home/me/specialfiles/group01subgroup01.nop /home/me/specialfiles/group01subgroup02.xyz /home/me/specialfiles/group01subgroup02.abc /home/me/specialfiles/group01subgroup02.nop /home/me/specialfiles/group01subgroup03.xyz /home/me/specialfiles/group01subgroup03.abc /home/me/specialfiles/group01subgroup03.nop /home/me/specialfiles/group01subgroup04.xyz /home/me/specialfiles/group01subgroup04.abc...

Command Line: Using a for loop to create directories with increasing names

batch-file,for-loop,cmd,dos,mkdir
I am trying to write a batch file that does the following: Prompt user for the directory to create the new folder newest Prompt user for an integer limit Create directory newest CD newest FOR loop for limit iterations Create directory "Month " + iteration For example: newest = Reports...

Making a writeable directory in laravel using mkdir()

php,mkdir
My issue isn't that the folder is getting written, it's the permissions that it's being written with. Here is the code I'm using the write the file: // check if the file/folder exists $targetPath = 'files/docmoga/'; if(!file_exists($targetPath)){ $oldmask = umask(0); mkdir($targetPath, '0777', true); umask($oldmask); } move_uploaded_file($tempFile, $targetFile); It's failing on...