directory

Batch Files: List all files in a directory, print as .txt and place output file in all sub directories

青春壹個敷衍的年華 提交于 2020-01-21 10:33:26
问题 1. Searched everywhere, I do find tutorials to print list of files in directory and sub directories using dir command as follows: @echo off dir /S > list.txt pause Above code will return all files in list.txt. We can use switches to get lists in various formats. What I am trying to do is: When I run batch file output file list.txt should be placed in all Sub Directories and not only in the directory from batch file is being executed. 2. I am trying to to rename list.txt as %current directory

Batch Files: List all files in a directory, print as .txt and place output file in all sub directories

谁都会走 提交于 2020-01-21 10:33:23
问题 1. Searched everywhere, I do find tutorials to print list of files in directory and sub directories using dir command as follows: @echo off dir /S > list.txt pause Above code will return all files in list.txt. We can use switches to get lists in various formats. What I am trying to do is: When I run batch file output file list.txt should be placed in all Sub Directories and not only in the directory from batch file is being executed. 2. I am trying to to rename list.txt as %current directory

How to create a folder in the home directory?

…衆ロ難τιáo~ 提交于 2020-01-21 04:36:12
问题 I want to create a directory path = "$HOME/somedir" . I've tried using boost::filesystem::create_directory(path) , but it fails - apparently the function doesn't expand system variables. How can I do it the simplest way? (note: in my case the string path is constant and I don't know for sure if it contains a variable) edit: I'm working on Linux (although I'm planning to port my app to Windows in the near future). 回答1: Use getenv to get environment variables, including HOME . If you don't know

Linux:SElinux导致网站无法访问

泄露秘密 提交于 2020-01-20 18:05:55
通过更改SElinux状态可以判断出,当SElinux处于关闭状态时,网站内容访问正常。 [root@master1-192-168-117-18 ~]# setenforce 0 [root@master1-192-168-117-18 ~]# getenforce Permissive [root@master1-192-168-117-18 ~]# setenforce 1 [root@master1-192-168-117-18 ~]# getenforce 0 Enforcing 查看网站的主目录的SElinux安全上下文值: [root@master1-192-168-117-18 ~]# ls -Zd /var/www/html/ drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 /var/www/html/ [root@master1-192-168-117-18 ~]# ls -Zd /home/wwwroot/ drwxr-xr-x. root root system_u:object_r:user_home_dir_t:s0 /home/wwwroot/ 将新添加的主目录SElinux上下文值与系统默认主目录保持一致: [root@master1-192-168-117-18 ~]#

Scan files in a directory and sub-directory and store their path in array using php

会有一股神秘感。 提交于 2020-01-20 07:09:10
问题 I want not scan all the files in a directory and its sub-directory. And get their path in an array. Like path to the file in the directory in array will be just path -> text.txt while the path to a file in sub-directory will be somedirectory/text.txt I am able to scan single directory, but it returns all the files and sub-directories without any ways to differentiate. if ($handle = opendir('fonts/')) { /* This is the correct way to loop over the directory. */ while (false !== ($entry =

Scan files in a directory and sub-directory and store their path in array using php

谁说我不能喝 提交于 2020-01-20 07:08:13
问题 I want not scan all the files in a directory and its sub-directory. And get their path in an array. Like path to the file in the directory in array will be just path -> text.txt while the path to a file in sub-directory will be somedirectory/text.txt I am able to scan single directory, but it returns all the files and sub-directories without any ways to differentiate. if ($handle = opendir('fonts/')) { /* This is the correct way to loop over the directory. */ while (false !== ($entry =

【整理】C#文件操作大全(SamWang)

旧巷老猫 提交于 2020-01-18 08:00:57
文件与文件夹操作主要用到以下几个类:   1.File类:   提供用于创建、复制、删除、移动和打开文件的静态方法,并协助创建 FileStream 对象。     msdn: http://msdn.microsoft.com/zh-cn/library/system.io.file(v=VS.80).aspx   2.FileInfo类:     提供创建、复制、删除、移动和打开文件的实例方法,并且帮助创建 FileStream 对象     msdn: http://msdn.microsoft.com/zh-cn/library/system.io.fileinfo(v=VS.80).aspx   3.Directory类:      公开用于创建、移动和枚举通过目录和子目录的静态方法。     msdn: http://msdn.microsoft.com/zh-cn/library/system.io.directory.aspx   4.DirectoryInfo类:     公开用于创建、移动和枚举目录和子目录的实例方法。     msdn: http://msdn.microsoft.com/zh-cn/library/system.io.directoryinfo.aspx    (注:以下出现的dirPath表示文件夹路径,filePath表示文件路径) 1

php realpath() returns a blank string

半世苍凉 提交于 2020-01-17 12:27:10
问题 Guided by this post Preventing Directory Traversal in PHP but allowing paths I am trying to prevent directory traversal, but I am experiencing something odd, in the first instance realpath returns a good path $fPath = $path.$parent.'/'.$name; //$name (the user input) in this sample is "fff", $parent is an empty string //make sure user didn't try to traverse backwards on the basepath $basepath = $path; $realBase = realpath($basepath); echo $realBase."<br/>"; //gives: /Users/me/Documents/www

C++ Makefile. .o in different subdirectories

亡梦爱人 提交于 2020-01-17 08:10:13
问题 I have some problems trying to put .o files into a separate directory (/build). Actually, my sources (in /src) contain some subdirectories, and my Makefile only create the .o of the .cpp contained at the first "level". The other .o are just ignored, so, the target cannot be created. In my /src directory, I have "three levels" (src/first/second/). Here's the code of the Makefile : CC=g++ CFLAGS=-W -Wall -ansi -pedantic -s -O3 -Os -std=c++11 -fpermissive LDFLAGS= -lboost_system -lboost_regex

Copy Sub directories to directory

断了今生、忘了曾经 提交于 2020-01-17 07:22:05
问题 Referencing this question/code: How do I copy a folder and all subfolders and files in .NET? I'm trying to copy a buntch of sub directories to a different directory. I'm wanting to update this code: Dim fso As System.Object = New System.Object fso = CreateObject("scripting.filesystemobject") fso.copyfolder(sour, dest) However I'm getting this error: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Temp\Summer2011\Newfolder\Copy of New Text Document.txt'. at System