filenames

Bash globbing - autoexpand for a few specific cases?

你。 提交于 2019-11-30 07:04:16
I understand that the wildcard * (by itself) will expand in such a way that it means "all non-hidden files in the current folder" with hidden files being those prefixed by a period. There are two use cases that I would think are useful, but I don't know how to properly do: How can you glob for... "All files in the current folder, including hidden files, but not including . or .. "? How can you glob for... "All hidden files (and only hidden files) in the current folder, but not including . or .. "? sth To expand on paviums answer and answer the second part of your question, all files except .

How to set filename containing spaces in Content-Disposition header

北城余情 提交于 2019-11-30 07:02:40
问题 I have this piece of code: resp.addHeader("Content-Disposition", "inline; filename=" + fileName); When the file name is "a_b_c.doc" or "abc.doc" the name of the downloaded file is displayed correctly. However, when the file name is "a b c .doc" the name of the downloaded file is only "a". How can we solve this? 回答1: Use quotes: resp.addHeader("Content-Disposition", "inline; filename=\"" + fileName + "\""); 回答2: According to the HTTP standard you surround the string with double-quotes, and

C# Filepath Recasing

陌路散爱 提交于 2019-11-30 04:44:28
I'm trying to write a static member function in C# or find one in the .NET Framework that will re-case a file path to what the filesystem specifies. Example: string filepath = @"C:\temp.txt"; filepath = FileUtility.RecaseFilepath(filepath); // filepath = C:\Temp.TXT // Where the real fully qualified filepath in the NTFS volume is C:\Temp.TXT I've tried the following code below and many variants of it and it still doesn't work. I know Windows is case-insensitive in general but I need to pass these file paths to ClearCase which considers file path casing since it's a Unix and Windows application

Get filename from string-path?

安稳与你 提交于 2019-11-30 04:31:52
How do I get the filename from this string? "C:\Documents and Settings\Usuario\Escritorio\hello\test.txt" output: "test.txt" I really tried to find this one before posting, but all the results were contaminated, they talk about getting filenames from current dir (I must work with strings only) Method 1 for %%F in ("C:\Documents and Settings\Usuario\Escritorio\hello\test.txt") do echo %%~nxF Type HELP FOR for more info. Method 2 call :sub "C:\Documents and Settings\Usuario\Escritorio\hello\test.txt" exit /b :sub echo %~nx1 exit /b Type HELP CALL for more info. if your path comes as a parameter,

Batch parameter %~s1 gives incorrect 8.3 short name

半腔热情 提交于 2019-11-30 04:05:46
问题 I'm trying to write a batch file in Windows XP that takes in a fully-qualified path name and outputs the 8.3 short name version... @echo off echo "%~s1" I have come across one particular case where this outputs an incorrect path and file... C:\>test.bat "C:\Documents and Settings\angus\Local Settings\Temporary Internet Files\Content.IE5\2JSTM34V\62[1].ja2" "C:\DOCUME~1\angus\LOCALS~1\TEMPOR~1\Content.IE5\2JSTM34V\62_1_~1.JA2M34V\62[1].ja2" Note that the above output ("C:\DOCUME~1\angus\LOCALS

Create (sane/safe) filename from any (unsafe) string

故事扮演 提交于 2019-11-30 03:06:51
I want to create a sane/safe filename (i.e. somewhat readable, no "strange" characters, etc.) from some random Unicode string (mich might contain just anything). (It doesn't matter for me wether the function is Cocoa, ObjC, Python, etc.) Of course, there might be infinite many characters which might be strange. Thus, it is not really a solution to have a blacklist and to add more and more to that list over the time. I could have a whitelist. However, I don't really know how to define it. [a-zA-Z0-9 .] is a start but I also want to accept unicode chars which can be displayed in a normal way.

Association between naming classes and naming their files in python (convention?)

给你一囗甜甜゛ 提交于 2019-11-30 02:38:25
In python (and some other languages) I have learned, that the name of a class should be written in small letters except for the first letter, which should be a capital letter. Example: class FooBar: ... A class should go in a file, named the same as the class. In this example it would be a file foobar.py . If I want to import the class foo somewhere I have to do this: from foobar import FooBar This convention confuses me a little. My intuition tells me, that if the filename indicates a class, than it should be written with the first letter in capitals, too, like FooBar.py . This don't look

For /f processing filename with spaces

☆樱花仙子☆ 提交于 2019-11-30 01:00:20
问题 I want to do some processing on each line of a file. for /f "delims=" %%i in ("%RF_PROPERTIES%") do ( echo %%i ) My RF_PROPERTIES points to a file path with spaces (c:\program files\Arcot systems\conf\rf.properties). It is complaining saying Environment variable C:\Program Files\Arcot not defined, even though I have provided quotes. How to get it working? 回答1: Try adding the usebackq option: for /f "usebackq delims=" %%i in ("%RF_PROPERTIES%") do ( echo %%i ) Explanation from the output of

Deleting filenames that have space and special characters

╄→гoц情女王★ 提交于 2019-11-29 17:25:46
I have a large filelist of 7000+ files to delete from a Unix directory. I could have accomplished this using a while loop while read file do rm $file done < filelist or just cat filelist | xargs rm The challenge comes from deleting those files which have "Windows-like back slash \, colon : and spaces " in their filenames. Eg. C:\Sxxx Accr Vac 1111.txt N:\Lxxx\Dxxx_FOLDER\Mxxx\Mxxx_DOWNLOAD_TEXTFILE_PATH\000000_Mxxx_Bxxx-Pxxx-H.txt N:\Lxxx\Dxxx_FOLDER\Mxxx\Mxxx_DOWNLOAD_TEXTFILE_PATH\130607_Mxxx_Bxxx-Cxxx-L.txt N:\Lxxx\Dxxx_FOLDER\Mxxx\Mxxx_DOWNLOAD_TEXTFILE_PATH\140103_Mxxx_Xxxx-Pxx-H.txt To

Name variable based on string MATLAB

倾然丶 夕夏残阳落幕 提交于 2019-11-29 17:22:30
I have a variable that is created by a loop. The variable is large enough and in a complicated enough form that I want to save the variable each time it comes out of the loop with a different name. PM25 is my variable. But I want to save it as PM25_year in which the year changes based on `str = fname(13:end)' PM25 = permute(reshape(E',[c,r/nlay,nlay]),[2,1,3]); % Reshape and permute to achieve the right shape. Each face of the 3D should be one day str = fname(13:end); % The year % Third dimension is organized so that the data for each site is on a face save('PM25_str', 'PM25_Daily_US.mat', '