filepath

Storing Large amount of file paths in DB

不羁的心 提交于 2019-12-08 12:42:08
问题 I need some approach for the most efficient way to store file (and folder) paths in DB (near a million records), such that I can search for there names. Saving the full path is obviously wrong, because a lot of repetition will occur, for example: C:\Windows C:\Windows\System C:\Windows\System\Notepad.exe For this, I built a simple hierarchical DB, with just three fields: ID Name Parent 0 C: null 1 Windows 0 2 System 1 3 Notepad.exe 2 And I am recovering item's path by using a "recursive with"

How to know the directory of jar file in java? [duplicate]

旧时模样 提交于 2019-12-08 06:26:13
问题 This question already has an answer here : Getting filesystem path of class being executed [duplicate] (1 answer) Closed 4 years ago . I have an executable jar file and I want it to be able to read and write info to a txt file that is located at the same dir as the .jar file is. How can I do that? How can I get the executable jar file dir path. It only has to work on windows platform and it's a desktop application. 回答1: You don't need to specify full path in order to create new files, java

Get Executable Path of Window by Handle - Access Denied

雨燕双飞 提交于 2019-12-08 05:27:05
问题 I am trying to get Executable Path of Window by Handle. I am using the following code to achieve: [DllImport("user32.dll")] private static extern int GetWindowThreadProcessId(IntPtr handle, out uint processId); public string GetFilePath(IntPtr hwnd) { try { uint pid = 0; GetWindowThreadProcessId(hwnd, out pid); Process proc = Process.GetProcessById((int)pid); //Gets the process by ID. return proc.MainModule.FileName.ToString(); //Returns the path. } catch (Exception ex) { return ex.ToString()

How can I canonicalize Windows file paths in Perl?

雨燕双飞 提交于 2019-12-08 05:22:26
问题 Update: I can make this a simpler problem to solve: I want to figure out what the correct regex would be to substitute any single occurrence of a back slash with two back slashes. I want to turn this: vlc.plugin.path = C:\Program Files\JekyllV0.9.2\\VLC_1.0.0\\plugins into: vlc.plugin.path = C:\\Program Files\\JekyllV0.9.2\\VLC_1.0.0\\plugins Original question: I want to change the following in a file using a Perl Regex: all occurrences of a single back slash to two back slashes all

PHP Keep the User's File Upload Path After Validation Fail

自古美人都是妖i 提交于 2019-12-08 04:32:32
问题 i want to ask that if its possible to keep the user's upload path where he selects from his computer that which file will be uploaded like the path " C:\Users\User1\Desktop\1.jpg " , the reason i want to learn about this is after submitting forms with php when he fails about validation, i want him to not reselect it.. Summary : How can i save the path : C:\Users\User1\Desktop\1.jpg in user's form if user fails on other field's validation Thanks 回答1: It is not possible. Only the filename is

accessing file on sdcard android

孤者浪人 提交于 2019-12-08 04:09:39
问题 I am new to Android development. I am trying to use the following code to email a file on my motorola milestone through gmail. Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.setType("audio/mp3"); sendIntent.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/king1.mp3"); sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject"); sendIntent.putExtra(Intent.EXTRA_TEXT, "this is the email content2"); sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/king1.mp3"));

How do I get the last part of this filepath?

扶醉桌前 提交于 2019-12-08 02:49:39
问题 I have a filepath that follows the following pattern: Some\File\Path\Base\yyyy\MM\dd\HH\mm\Random8.3 I want to extract everything from 2012 and beyond, but the problem is that while the right side is standard the base directory can be different for each record. Here are two examples: C:\Temp\X\2012\08\27\18\35\wy32dm1q.qyt Returns: 2012\08\27\18\35\wy32dm1q.qyt D:\Temp\X\Y\2012\08\27\18\36\tx84uwvr.puq Returns: 2012\08\27\18\36\tx84uwvr.puq Right now I'm grabbing the LastIndexOf(Path

Python's trace module and filepaths

佐手、 提交于 2019-12-08 01:34:45
问题 I am using python's trace module to trace the execution of some code. I notice that when the execution is later printed, it is printed in the following form (min working example follows below): <filename>(<line number>): <line of code> Is possible to get the full (either absolute or relative) file path instead of just the file name. It makes sense that there would be a flag somewhere in the call to trace.Trace that should allow me to do this, but I don't seem to be able to find any such

Preventing duplicate slashes in file paths

我只是一个虾纸丫 提交于 2019-12-08 01:18:28
问题 I would like to build a path to a file, given a filename and a folder where that file exists. The folder may include a trailing slash or it may not. In python, os.path.join solves this problem for you. Is there a base R solution to this problem? If not, what is the recommended way in R to build file paths that do not have duplicate slashes? This works fine: > file.path("/path/to/folder", "file.txt") [1] "/path/to/folder/file.txt" But if the user provides a folder with a trailing slash, file

How to handle file paths with special characters?

有些话、适合烂在心里 提交于 2019-12-07 19:01:51
问题 I've got a PowerShell script that needs to be able to call another PS script from within the same directory with elevated credentials. Because the scripts need to be portable, the file path of the scripts isn't known ahead of time and needs to be able to handle spaces and special characters in the file path without failing. Since elevating a PS session will cause the current working directory to change to "C:\Windows\System32", I need to be able to pass the current directory to the script as