directory

How to get file from directory with pattern/filter

我是研究僧i 提交于 2019-12-19 17:14:02
问题 I have to get a file from a PDF files directory. I have problem that I haven't a field to concant all data to find the file. Here's an example: File name: Comp_20120619_170310_2_632128_FC_A_8_23903.pdf File name generate: Comp_20120619_--------_2_632128_FC_A_8_23903.pdf I dont' have the field "--------" to make file COMPLETE name. I'm trying with File.list but I cannot find the correct file. 回答1: You can define a FilenameFilter to match against the filenames, and return true if the filename

PHP How to header-location to a page in a parent directory?

亡梦爱人 提交于 2019-12-19 16:13:12
问题 I have a first.php page with header("Location: script/script1.php") and script1.php has another header("Location: first.php") but it sends me obviously to /script/first.php . Is there a way to redirect it to <root>/first.php instead of <root>/script/first.php ? 回答1: have a try with this: header("Location: ../first.php") or use an absolute path or url instead. Explanation: .. is the unix/linux expression used for 'parent directory'. The Internet is unix land, so that rules applies there too.

PHP How to header-location to a page in a parent directory?

淺唱寂寞╮ 提交于 2019-12-19 16:13:10
问题 I have a first.php page with header("Location: script/script1.php") and script1.php has another header("Location: first.php") but it sends me obviously to /script/first.php . Is there a way to redirect it to <root>/first.php instead of <root>/script/first.php ? 回答1: have a try with this: header("Location: ../first.php") or use an absolute path or url instead. Explanation: .. is the unix/linux expression used for 'parent directory'. The Internet is unix land, so that rules applies there too.

save image file in specific directory jsf primefaces project

橙三吉。 提交于 2019-12-19 12:20:33
问题 I want to save byte[] file into a specific directory : I get it from this method : public void setUploadedPicture(UploadedFile uploadedPicture) { System.out.println("set : "+uploadedPicture.getFileName()+" size : "+uploadedPicture.getSize()); this.uploadedPicture = uploadedPicture; } and I access the byte[] with : uploadedPicture.getContents() I tested this link but no result how to save it into a specific directory either inside my project or outside thank you ** * ** * *** EDIT * ** * ** *

How to put two backslash in C++

柔情痞子 提交于 2019-12-19 11:49:19
问题 i need to create a function that will accept a directory path. But in order for the compiler to read backslash in i need to create a function that will make a one backslash into 2 backslash.. so far this are my codes: string stripPath(string path) { char newpath[99999]; //char *pathlong; char temp; strcpy_s(newpath, path.c_str()); //pathlong = newpath; int arrlength = sizeof(newpath); for (int i = 0; i <= arrlength ;i++) { if(newpath[i] == '\\') { newpath[i] += '\\'; i++; } } path = newpath;

Drag and drop listview C#

做~自己de王妃 提交于 2019-12-19 11:49:16
问题 Hi how to I enable drag event handler when I double click on the listview? This is what I get after double-clicking on the listview private void listView1(object sender, EventArgs e) However, I want it to be private void listView(object sender,DragEventArgs e) How to I do it..? I have tried many way such as: private void Form_Load(object sender, EventArgs e) { // Enable drag and drop for this form // (this can also be applied to any controls) this.AllowDrop = true; // Add event handlers for

Batch script to create folders based on filenames

*爱你&永不变心* 提交于 2019-12-19 10:45:11
问题 I have a folder with a lot of PNG images that I want to create folders for based on their filenames. I would then want the files to be moved into their respective folders of the same name and renamed to 0000.png. Example: - abcd.png - efghi.png - jklm.png - nopqr.png - stuv.png - wxyz.png To: - abcd/0000.png - efghi/0000.png - jklm/0000.png - nopqr/0000.png - stuv/0000.png - wxyz/0000.png 回答1: from the command line for /f %f in ('dir *.png /b') do md %~nf & move %f .\%~nf\0000.png if in the

Application crashing when talking to oracle unless executable path contains spaces

拟墨画扇 提交于 2019-12-19 10:42:25
问题 We have an x-files problem with our .NET application. Or, rather, hybrid Win32 and .NET application. When it attempts to communicate with Oracle, it just dies. Vanishes. Goes to the big black void in the sky. No event log message, no exception, no nothing. If we simply ask the application to talk to a MS SQL Server instead, which has the effect of replacing the usage of OracleConnection and related classes with SqlConnection and related classes, it works as expected. Today we had a

Why am I having problems recursively deleting directories?

旧时模样 提交于 2019-12-19 09:24:20
问题 I've written an application that uses the WIN32 api to create a temporarily directory hierarchy. Now, when wanting to delete the directories when shutting down the application I'm running into some problems. So lets say I have a directory hierarchy: C:\temp\directory\subdirectory\ I'm using this recursive function: bool Dir::deleteDirectory(std::string& directoryname, int flags) { if(directoryname.at(directoryname.size()-1) != '\\') directoryname += '\\'; if ((flags & CONTENTS) == CONTENTS) {

powershell remove all permissions on a folder for a specific user

情到浓时终转凉″ 提交于 2019-12-19 09:19:42
问题 I need a script or simple powershell code for removing all permissions to a folder for specific user, by inheriting these deletion to all the subfolders and files as well - recursively... Thank you in advance! 回答1: $acl=get-acl c:\temp $accessrule = New-Object system.security.AccessControl.FileSystemAccessRule("domain\user","Read",,,"Allow") $acl.RemoveAccessRuleAll($accessrule) Set-Acl -Path "c:\temp" -AclObject $acl this should wipe all security rules for user in c:\temp recursively 回答2: i