filenames

Invalid characters in a filename on Windows?

不打扰是莪最后的温柔 提交于 2019-12-05 16:15:06
As per the MSDN , the following characters cannot be part of the file name: Use any character in the current code page for a name, including Unicode characters and characters in the extended character set (128–255), except for the following: ◦The following reserved characters: < (less than) > (greater than) : (colon) " (double quote) / (forward slash) \ (backslash) | (vertical bar or pipe) ? (question mark) * (asterisk) In .net an api is provided to find the what are the characters not allowed in a filename char[] invalidFileChars = Path.GetInvalidFileNameChars(); Remarks The array returned

Any rules about underscores in filenames in C/C++? [closed]

一曲冷凌霜 提交于 2019-12-05 16:08:39
I know that there are rules for using underscores in identifiers in C/C++ . Are there any rules for using them in source code filenames? For instance, are there any restrictions against beginning or ending a filename with an underscore? Or having an underscore as the last character before the .c or .h extension? Double underscores? References are appreciated, if there are any. If the source files are subject for preprocessor #include directives, then the C and C++ standards specify a minimum set of requirements on the filename. The C standard says: 6.10.2 Source file inclusion ... The

C# Get Path/Filename by Handle (hWnd) 32 and 64bit

徘徊边缘 提交于 2019-12-05 15:20:52
I got the following code to get path/filename by handle: [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern int GetWindowThreadProcessId(IntPtr handle, out uint processId); public static string GetProcessPath(IntPtr hwnd) { uint pid = 0; GetWindowThreadProcessId(hwnd, out pid); Process proc = Process.GetProcessById((int)pid); return proc.MainModule.FileName.ToString(); } it works perfect in 32 bit but I get error in 64bit > "Only part of the ReadProcessMemory or WriteProcessMemory request was completed." the project is compiled as x86 (platform target

Getting the name & extension of an uploaded file using python (google app engine)

假如想象 提交于 2019-12-05 14:34:42
I am using a form to upload files to the google app engine and store them in the datastore. l would also like to store the original file name and extension for presentation purposes. Is there a way of retrieving this data from the post sever side or can it only be gathered client side and sent as separate fields (e.g. http://www.tinyurl.com/5jybfq )? Many thanks. For those that follow the solution dased on the answer below: this_file = self.request.params["file_upload_form_field_name"].filename (this_file_name, this_file_extension) = os.path.splitext(this_file) self.response.out.write("File

Force Save as XLSM While Maintaining File Structure

倾然丶 夕夏残阳落幕 提交于 2019-12-05 12:44:57
So I am working with a XLTM file, and I want the user to make sure they save as XLSM. When they click "Save," this works fine, but I find when they click "Save As," the file is saved as "*.xlsm.xlsm". I am a little lost with how to make sure that the user saves as XLSM, while keeping the file name as "filename.xlsm" and not "filename.xlsm.xlsm". 'Action makes sure the user saves as XLSM file type. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim FileNameVal As String If SaveAsUI Then FileNameVal = Application.GetSaveAsFilename(, "Excel Macro-Enabled Workbook (*

Using urllib2 in Python. How do I get the name of the file I am downloading?

ε祈祈猫儿з 提交于 2019-12-05 08:28:37
I am a python beginner. I am using urllib2 to download files. When I download a file, I specify a filename to with which to save the downloaded file on my hard drive. However, if I download the file using my browser, a default filename is automatically provided. Here is a simplified version of my code: def downloadmp3(url): webFile = urllib2.urlopen(url) filename = 'temp.zip' localFile = open(filename, 'w') localFile.write(webFile.read()) The file downloads just fine, but if I type the string stored in the variable "url" into my browser, there is a default filename given to the file when I

Downloading file matching pattern using phpseclib

﹥>﹥吖頭↗ 提交于 2019-12-05 06:14:52
问题 I am trying to download a file from a SFTP server. I have managed to connect to it and download the files. The problem is that the file in the server will be updated daily and part of the filename is the exact time when it is generated which is unpredictable. How can I implement my PHP script so it downloads any XML file which name starts with a certain pattern but I don't know the exact full name? 回答1: You have to retrieve a list of all files in the remote directory using Net_SFTP::nlist.

Copy certain files from one folder to another using python

纵饮孤独 提交于 2019-12-05 06:01:29
I am trying to copy only certain files from one folder to another. The filenames are in a attribute table of a shapefile. I am successful upto writing the filenames into a .csv file and list the column containing the list of the filenames to be transferred. I am stuck after that on how to read those filenames to copy them to another folder. I have read about using Shutil.copy/move but not sure how to use it. Any help is appreciated. Below is my script: import arcpy import csv import os import sys import os.path import shutil from collections import defaultdict fc = 'C:\\work_Data\\Export

Python IOError exception when creating a long file

╄→尐↘猪︶ㄣ 提交于 2019-12-05 05:12:42
I get an IOError shown below when trying to open a new file using "open (fname, 'w+')". The complete error message is below. The file does not exist, but I verified using "os.access(dir_name, os.W_OK)" and "os.path.exists (dir_name)" that the parent directory for the file does exist. I am wondering if the file name is just too long for Windows, or if I am doing something wrong. Any tips would be appreciated. Thank you very much. Error message: IOError: [Errno 2] No such file or directory: 'C:\Documents and Settings\Administrator\op_models\Corp_Network_Nov12\abcde_corporate_nov_12.project\abcde

How to open multiple files with Delphi program invoked via shell open

十年热恋 提交于 2019-12-05 03:55:22
问题 I am currently using: if ParamStr(1)<>'%1' then begin address.Text:=ParamStr(1); autoconfigfile; end; to pick up the name of the file that was used to open the file with via file association. I now want to develop the ability to operate on multiple files. I.e. if I select 5 files and right click and select open with "EncryptionSystem". I have the registry entry: reg.OpenKey('*\shell\Encrypt\command', true); reg.WriteString('','C:\Program Files\EncryptionSystem\EncryptionSystem.exe "%1"'); reg