mkdir

Getting a dynamically created folder name using mkdir() in PHP

那年仲夏 提交于 2019-12-12 03:45:28
问题 I am dynamically creating folders for each user in my php file with mkdir("Userfiles/".$company."_".$time_stamp); I want to save that directory in a variable or any other and I have to use the directory name for saving my .txt files in it $myFile = "exfiles/".str_replace(" ","-",$_POST['company'])."_CC Booth furnishings ".$order_type."_".$time_stamp.".txt"; In the place of 'exfiles' I need to give the dynamically created directory name. Any help will be appreciated. Thanks 回答1: $dirname =

trouble in mkdir with Chinese characters on window + xampp

十年热恋 提交于 2019-12-12 02:25:26
问题 I am trying to create a folder with name 测试 on xampp installed on my windows computer. $new = "测试"; mkdir("test/$new"); It creates folder but the folder name is 测试 not 测试 . Please help 回答1: Try this: $new = mb_convert_encoding("测试", 'CP936', 'UTF-8'); mkdir("test/".$new,0777); 回答2: Try this $new = "测试"; mkdir("test/".$new,0777); 回答3: Try this $new = urlencode ("测试"); mkdir("test/".$new,0777); and use urldecode if you want original name; 来源: https://stackoverflow.com/questions/38789788

Permission denied mkdir for cron and browser

試著忘記壹切 提交于 2019-12-11 19:27:58
问题 We have an PHP XML parsing script that uploads photos to a folder structure like /content/images/2012/05/31/%object_id%/ . This parser runs primarily as a DirectAdmin cronjob. We run into many problems getting the folder permissions right to enable the uploading in that directory for both the cronjob as running the parser via the browser. According to print_r(posix_getpwuid(fileowner($directory))); the owner of the directory is is the same as get_current_user() . Nevertheless I receive:

LFTP mkdir -p doesn't work with sftp protocol?

a 夏天 提交于 2019-12-11 13:54:23
问题 here is the server directory structure: /tmp/a and I can only connect to the server with sftp Now I want to mkdir first, and then upload some files into it. mkdir -p /tmp/a/b works, but mkdir -p /tmp/a/b/c/d/e/f/g doesn't. I think the param -p is for this situation, anything wrong? Thanks! 回答1: New version lftp support mkdir -p with sftp protocal. 回答2: mput -d some/path/file.txt Create directories the same as in file names and put the files into them. 来源: https://stackoverflow.com/questions

Expect script reading commands from file

半腔热情 提交于 2019-12-11 09:23:03
问题 I'm trying to write an expect script that reads commands from a file and executes them, as explained in this topic. Here is my script called script.sh : #!/usr/bin/expect set f [open "script_cmds.txt"] set cmds [split [read $f] "\n"] close $f foreach cmd $cmds { spawn cmd } expect eof close And the file script_cmds.txt , situated in the same folder, looks like this: mkdir cmdlisttest1 mkdir cmdlisttest2 To compile and run the script on cygwin I use chmod +x script.sh d2u script.sh ./script.sh

Expect script not able to read mkdir from file and execute

大憨熊 提交于 2019-12-11 08:27:55
问题 This is a continuation of this topic; since it's a different question from the OP I'm making a new topic. I have an expect script I can't get working that is supposed to read commands from a file and execute them. This is the script itself, called script.sh : #!/usr/bin/expect set prompt {\$\s*$} set f [open "script_cmds_u.txt"] set cmds [split [read $f] "\n"] close $f foreach cmd $cmds { spawn $cmd expect -re $prompt } expect eof close The file script_cmds.txt looks like this: mkdir

Warning in iCloud integration

本秂侑毒 提交于 2019-12-11 08:12:03
问题 I am trying to integrating iCloud. Everything works fine but when I try to read a file from iCloud I get a warning Like: Foundation called mkdir("/var/mobile/Library/Mobile Documents/.ubd/peer-E8A60A8F-FB9D-8721-F47C-hdffgdfg-v23/ftr/(A Document Being Saved By XYZ)"), it didn't return 0, and errno was set to 1. My Code to fetch Data: for (NSMetadataItem *item in results) { NSString *filename = [item valueForAttribute:NSMetadataItemDisplayNameKey]; NSURL *url = [item valueForAttribute

Google Api Client Php - mkdir():Permission denied

馋奶兔 提交于 2019-12-11 07:54:04
问题 Using google api client for php to fetch some data, I have encountered the following error and I can't seem to find any working solution so far. mkdir(): Permission denied $storageDir = $this->path . '/' . substr(md5($file), 0, 2); if ($forWrite && ! is_dir($storageDir)) { if (! mkdir($storageDir, 0755, true)) { throw new Google_Cache_Exception("Could not create storage directory: $storageDir"); } I checked the permissions, users and groups. Everything is fine but I can't figure what's the

JUnit test scanning folder class

穿精又带淫゛_ 提交于 2019-12-11 06:23:40
问题 I want write several tests, but from a high level each of them should populate a directory structure with some files. I'd test each of these cases at least: A single folder with a file that passes the filter. A single folder with a file that does NOT pass the filter. A nested folder with a file in each. Code: class FolderScan implements Runnable { private String path; private BlockingQueue<File> queue; private CountDownLatch latch; private File endOfWorkFile; private List<Checker> checkers;

manipulating a string to create directories in unix

无人久伴 提交于 2019-12-10 23:27:21
问题 I want to take a word as input and creating consecutive directories using the letters of this word in unix shell. I tried sed, awk and fold commands but did not obtaiın any useful result. Any advice? For example: If input is hello , it should create h/e/l/l/o directories as one inside another. In other words, h will be the top directory and o will be the deepest subdirectory. 回答1: This should do the trick in any Bourne compatible shell: $ mkdir -p $(echo foobar | sed 's:\(.\):\1/:g') $ find f