directory

Multiple filters with Directory.GetFiles?

六月ゝ 毕业季﹏ 提交于 2019-12-11 16:13:35
问题 I'm trying to use multiple filters with the Directory.GetFiles() command. So say I want to match both .html and .css files. I'm using this: Directory.GetFiles(path,"*.html|*.css"); I don't see any documentation however that this is supported, and it ends up not matching either HTML or CSS files. Is there something I'm missing? 回答1: The Directory.GetFiles function doesn't support multiple filters. My solution: string patter = "*.jpg|*.png|*.gif"; string[] filters = patter.Split('|'); foreach

How to recursively go through folders and count total file size

时光毁灭记忆、已成空白 提交于 2019-12-11 14:49:00
问题 I am trying to recursively go through my directories and print file size, then at the end print the total of all file size's. I cannot figure out what to pass my function recursively, and my variable total does not end up being correct,any help is greatly appreciated, thanks so much in advance. #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <dirent.h> #include <string.h> #include <stdlib.h> void do_ls(char[]); int total = 0; int main(int ac, char *av[]) { if (ac == 1

Python directory searching and organizing by dict

余生长醉 提交于 2019-12-11 14:48:16
问题 Hey all, this is my first time recently trying to get into the file and os part of Python. I am trying to search a directory then find all sub directories. If the directory has no folders, add all the files to a list. And organize them all by dict. So for instance a tree could look like this Starting Path Dir 1 Subdir 1 Subdir 2 Subdir 3 subsubdir file.jpg folder1 file1.jpg file2.jpg folder2 file3.jpg file4.jpg Even if subsubdir has a file in it, it should be skipped because it has folders in

Function to remove directory removes it only after debug finishes c++

て烟熏妆下的殇ゞ 提交于 2019-12-11 14:43:41
问题 I have this code in c++ to remove directory that includes files in it: void* hFind = INVALID_HANDLE_VALUE; WIN32_FIND_DATA ffd; hFind = FindFirstFile((fullpath+"\\" + _docname + "\\"+"*").c_str(), &ffd); do //delete all the files in the directory { // check if it is a file if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { string s = (fullpath+_docname+"\\").append(ffd.cFileName); remove(s.c_str()); } } while (FindNextFile(hFind, &ffd) != 0); removeDirectory(fullpath+"\\" + _docname);

How to rename the folders and subfolders including the files present in it recursively using Java NIO Files?

浪尽此生 提交于 2019-12-11 14:43:27
问题 I cant able to rename the folder which contains a files or sub folders in it. My Folder structure is D: root popcorn-folder1 popcorn-subfolder1 popcorn-subfile1 popcorn-file1 popcorn-folder2 popcorn-subfolder2 popcorn-file2 My resulting Directory should be D: root folder1 subfolder1 subfile1 file1 folder2 subfolder2 file2 My tried code is package com.din.pach; import java.io.File; import java.io.IOException; import java.nio.file.FileVisitResult; import java.nio.file.FileVisitor; import java

Are friendly URLs based on directories?

房东的猫 提交于 2019-12-11 14:24:10
问题 I've been reading many articles about SEO and investigating how to improve my site. I found an article that said that having friendly URLs help online indexers to find and positionate your site better than using URLs with lots of GET parameters so I decided to adapt my site to this kind of URL. I've also read that there's a way (editing .htaccess) but it's not the best way and it doesn't look really good. For example, that's how Google's About URL looks like: https://www.google.com/search

asp.net folder authorization

不想你离开。 提交于 2019-12-11 14:11:28
问题 I'm using my own database and forms authentication. The database contains one table with users and second one with roles, that users are assigned to. The question is: how to prepare the section in web.config, so it allows acces to the folder only for users belonging to one of the roles? Second question: Using IIS configuration I can block direct access to all folders in the web directory. Let's say, that one of pages will contain links allowing to download files from those protected folders.

How to switch directories using C#?

谁都会走 提交于 2019-12-11 14:10:37
问题 (This is a continuation of the discussion on this question) I have code that looks in a specific folder in the C: drive. It can tell what is in that folder, and gets what the user selects. But the problem is switching to a new Data folder to get the code from. All the code necessary to run the program is kept in the Data folder, the company I am interning with wants to be able to switch Data folders so they can show their software off better, and have it geared towards whoever they are

Pull all images from multiple directories and display them with PHP

此生再无相见时 提交于 2019-12-11 13:34:47
问题 I have a folder on my server called 'images', and within that folder I could have a single folder to as many as 10 folders that contain images. Instead of writing a tag for each image <img src="images/people/001.jpg"> <img src="images/landscape/001.jpg"> etc etc Can I use PHP to get all the images in all the folders in the main directory 'images'? I have VERY little experience with PHP, so this is something I am struggling with. I need php to return an array of ' <div class="box"><img src=

Directory structure for large number of files

自闭症网瘾萝莉.ら 提交于 2019-12-11 13:33:58
问题 I made one site... where i am storing user uploaded files in separate directories like user_id = 1 so img/upload_docs/1/1324026061_1.txt img/upload_docs/1/1324026056_1.txt Same way if user_id = 2 so img/upload_docs/2/1324026061_2.txt img/upload_docs/2/1324026056_2.txt ... n So now if in future if I will get 100000 users then in my upload_docs folder I will have 100000 folders. And there is no restriction on user upload so it can be 1000 files for 1 user or 10 files any number of files... so