directory

How to create a directory in Lua?

青春壹個敷衍的年華 提交于 2020-01-12 13:56:26
问题 Is it possible to create a directory in lua ? If so, how ? 回答1: There's a "system" call (or something like that, this is from memory) which you should be able to use to run an arbitrary program, which could include the mkdir command. EDIT: I found my Programming in Lua book. On page 203, it mentions how you could use an os.execute("mkdir " .. dirname) to "fake" a directory creation command. EDIT 2: Take note of Jonas Thiem's warning that this command can be abused if the directory name comes

rename folder into sub-folder with PHP

走远了吗. 提交于 2020-01-12 12:50:48
问题 I'm trying to move a folder by renaming it. Both the test1 and test2 folders already exist. rename( "test1", "test2/xxx1/xxx2" ); The error I get is: rename(...): No such file or directory I assume this is because the directory "xxx1" does not exist. How can I move the test1 directory anyway? 回答1: You might need to create the directory it is going into, e.g. $toName = "test2/xxx1/xxx2"; if (!is_dir(dirname($toName))) { mkdir(dirname($toName), 0777, true); } rename("test1", $toName); The third

/etc/passwd

假如想象 提交于 2020-01-12 08:42:08
嵌入式Linux往往没有用户管理,shell登陆也仅仅是给开发者用的。因此,像Android,无需输入用户名,可以直接登入shell。如果你需要用户管理(嵌入式Linux通常只需要root),可以添加/etc/passwd。login shell读取输入的用户名和密码后,在passwd文件中验证输入的合法性。 添加passwd前,必须了解passwd的格式。 The /etc/passwd contains one entry per line for each user (or user account) of the system. All fields are separated by a colon (:) symbol. Total seven fields as follows. Generally, passwd file entry looks as follows (click to enlarge image): (Fig.01: /etc/passwd file format - click to enlarge) Username : It is used when user logs in. It should be between 1 and 32 characters in length. Password : An x character

PHP script to traverse directory/file tree and output tree as nested ULs [closed]

Deadly 提交于 2020-01-12 08:27:10
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . I have a tree of directories, sub-directories, and files (in some but not all the directories). Here's an example of the whole tree: /food /food/drinks /food/drinks/water.html /food/drinks/milk.html /food/drinks/soda.html /food/entrees /food/entrees/hot /food/entrees/hot/hamburger

how can the directory of a usb drive connected to a system be obtained?

我只是一个虾纸丫 提交于 2020-01-12 08:24:08
问题 I need to obtain the path to the directory created for a usb drive(I think it's something like /media/user/xxxxx) for a simple usb mass storage device browser that I am making. Can anyone suggest the best/simplest way to do this? I am using an Ubuntu 13.10 machine and will be using it on a linux device. Need this in python. 回答1: This should get you started: #!/usr/bin/env python import os from glob import glob from subprocess import check_output, CalledProcessError def get_usb_devices(): sdb

how to change the directory location in command prompt using C#?

蓝咒 提交于 2020-01-12 07:59:46
问题 I have successfully opened command prompt window using C# through the following code. Process p = new Process(); p.StartInfo.FileName = "cmd.exe"; p.StartInfo.WorkingDirectory = @"d:\pdf2xml"; p.StartInfo.WindowStyle = ProcessWindowStyle.Normal; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardInput = true; p.Start(); p.StandardInput.WriteLine(@"pdftoxml.win32.1.2.7 -annotation "+filename); p.StandardInput.WriteLine(@"cd D:\python

I need “/var/www” but Apache2 try to use an empty “/var/www/html”

我的梦境 提交于 2020-01-12 05:39:08
问题 This days I sleep with my http://localhost working, and reading pages from /var/www ... I woke up with an "AH00094" error at Apache2 log, and (Apache2 created?) a surprised /var/www/html , that Apache2 try to use. Now my http://localhost/anything not works (error 404 at browser). How to fix it? I need back my http://localhost working with files at /var/www ! Context I am using Ubuntu12 with Apache2, all default and standard. I checked out error log by tail /var/log/apache2/error.log in order

How do I create a directory from within Emacs?

亡梦爱人 提交于 2020-01-11 14:48:36
问题 How exactly can I create a new directory using Emacs? What commands do I use? (If possible, please provide an example) 回答1: to create the directory dir/to/create , type: M-x make-directory RET dir/to/create RET to create directories dir/parent1/node and dir/parent2/node , type: M-! mkdir -p dir/parent{1,2}/node RET It assumes that Emacs's inferior shell is bash / zsh or other compatible shell. or in a Dired mode + It doesn't create nonexistent parent directories. Example: C-x d *.py RET ;

Using `read` system call on a directory

旧巷老猫 提交于 2020-01-11 09:52:32
问题 I was looking at an example in K&R 2 (8.6 Example - Listing Directories). It is a stripped down version of Linux command ls or Windows' dir . The example shows an implementation of functions like opendir , readdir . I've tried and typed the code word-by-word but it still doesn't work. All it does is that it prints the a dot (for the current directory) and exits. One interesting thing I found in the code (in the implementation of readdir ) was that it was calling the system calls like open and

Wildfly 10 issue with css file

三世轮回 提交于 2020-01-11 09:16:32
问题 <h:outputStylesheet library="test/css" name="style.css" /> Above code is not working in wildfly 10 with jar file jsf-impl-2.2.12-jbossorg-2 . Issue getting is: WARNING [javax.enterprise.resource.webcontainer.jsf.application] (default task-6) JSF1064: Unable to find or serve resource, style.css, from library, test/css. Can anyone help on this ? 回答1: The value of a library attribute should not be a path but a reference to a single folder (grouping css ,js etc.) and a direct descendant of the