directory

last_write_time Mismatch on Copied Directories

北城余情 提交于 2019-12-14 03:15:34
问题 I'm uncertain whether this is a platform difference or an implementation difference. I'm hoping that someone can help me shed light on that. Given this code: filesystem::path foo("foo"); filesystem::path bar("bar"); filesystem::create_directories(foo); filesystem::copy(foo, bar); const auto fooftime = filesystem::last_write_time(foo); const auto barftime = filesystem::last_write_time(bar); const auto foocftime = decltype(fooftime)::clock::to_time_t(fooftime); const auto barcftime = decltype

Preorder tree traversal copy folder

99封情书 提交于 2019-12-14 02:39:06
问题 We have a database that contains several Trees. These trees are build using the "Preorder tree traversal" principle. This is a very powerful way of creating trees but it has one big disadvantage, adding multiple nodes at once. We have to create a copy function in our tree, copying a single (lowest level) node is very easy, you can do this in one call. But now we want to copy a whole folder at once. We were wondering if we should do this in .net of with a stored procedure. We have to make sure

loop and rename all subfolders in php

无人久伴 提交于 2019-12-13 23:53:05
问题 I'm struggling to find any information on looping through all subfolders within a folder and renaming them using PHP. I am renaming them so that I do not reach any limits on numbers of subfolders. At the moment my user folder structure is as follows : images/logos/1216/logo.jpg images/logos/11437/logo.jpg images/logos/234438/logo.jpg So I want to loop through all folders within the 'logos' and rename them as follows : images/users/1/1216/logos/logo.jpg images/users/11/11437/logos/logo.jpg

php: get the directory in which resides a file [duplicate]

喜夏-厌秋 提交于 2019-12-13 21:17:18
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: PHP: let a file return its own directory. Hi I have a file located in a directory like this: C:\wamp\www\site\modules\file.php How can I get the current directory of file.php from within that script? This directory should look like modules in this case I needs this directory name to build a URL path to a css file from the same directory. 回答1: dirname(__FILE__) . "/" . basename(__DIR__) or dirname(__FILE__) 回答2:

How can I rename a directory in bash, without overwriting or moving inside a pre-existing target?

不想你离开。 提交于 2019-12-13 20:29:24
问题 I want to rename a directory, only if the target does not exist. To do this the syntax should be mv -n -T my/dir my/dirNew Where -n means "don't overwrite" and -T means "don't move into the target" (https://askubuntu.com/a/763915/461996) Unfortunately, -T is not an option on OSX, so any scripts making use of it won't work for OSX. So, how can I rename a directory only if it won't overwrite one? I've checked, and rename is not a standard I can depend on. 回答1: If its not necessary for you to

构建虚拟主机之基于域名

允我心安 提交于 2019-12-13 20:04:39
什么是虚拟web主机? 在同一台服务器中运行多个web站点,其中每一个站点并不独立占用一台真正的计算机。 httpd支持的虚拟主机类型 基于域名的虚拟主机 基于IP地址的虚拟主机 基于端口的虚拟主机 构建基于域名的虚拟主机 一、构建DNS服务器 1.安装bind、hettpd包 2.修改配置文件 3.测试DNS是否能进行域名解析 客户机上一定要修改配置自定义DNS服务器 使用“nslookup”命令查看 二、构建虚拟主机 1.在/etc/httpd/conf下创建扩展配置文件 <VirtualHost *:80> # 针对于本服务器的所有ip地址都可以经过80端口访问 DocumentRoot "/var/www/html/kgc" #站点目录 ServerName www.kgc.com #域名 ErrorLog "logs/www.kgc.com.error_log" #errorlog错误日志文件 CustomLog "logs/www.kgc.com.access_log" common #cuntomlog 访问日志 后面跟common命令 <Directory "/var/www/html"> Require all granted </Directory> #Directory列表 </VirtualHost> <VirtualHost *:80>

Reorganize folders with a script

走远了吗. 提交于 2019-12-13 18:46:27
问题 Through the last years I have different types of software to organize my photo and music collections. This has resulted in differences in directory structure, and I'd like this to be uniform. Problem a: Music collection I want my music collection to look like: /Artist/Album/files.* but now there are several instances of /A/Artist/Album/files.* I'm trying to write a script which: 1. Find all folders with 1 character, 2. Move contents of each one-character folder, to /Artist/ (Flatten structure

Robocopy: copy files preserving folder structure but adding a subfolder [closed]

自作多情 提交于 2019-12-13 15:54:50
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I need to copy a folder which contains subfolders with files to a shared folder on another machine. During that the script should create a custom sub folder in each destination folder and place files there. I hope this example clatifies the task: For the following source folder: --Logs ----Application -----

Windows 7 Create Folder in “Program Files” failing in C# code even thought I have admin rights!

萝らか妹 提交于 2019-12-13 15:49:16
问题 I am unable to create a file under "program files" folder on my Windows 7 64-bit machine in VS 2008 WPF C# code. The error I get on the following code myFile = File.Create(logFile); is the following. (this is the innerException stack trace). at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES

Shell Script for renaming and relocating the files

我与影子孤独终老i 提交于 2019-12-13 15:34:44
问题 I am working on something and need to solve the following. I am giving a analogous version of mine problem. Say we have a music directory, in which there are 200 directories corresponding to different movies. In each movie directory there are some music files. Now, say a file music.mp3 is in folder movie.mp3 . I want to make a shell script such that it renames the file to movie_music.mp3 and put it in some folder that I mention to it. Basically, all the files in the subdirectories are to be