filenames

matlab iterative filenames for saving

你说的曾经没有我的故事 提交于 2019-11-29 15:45:01
this question about matlab: i'm running a loop and each iteration a new set of data is produced, and I want it to be saved in a new file each time. I also overwrite old files by changing the name. Looks like this: name_each_iter = strrep(some_source,'.string.mat','string_new.(j).mat') and what I#m struggling here is the iteration so that I obtain files: ...string_new.1.mat ...string_new.2.mat etc. I was trying with various combination of () [] {} as well as 'string_new.'j'.mat' (which gave syntax error) How can it be done? For creating a name based of an already existing file, you can use

Renaming A Running Process' File Image On Windows

China☆狼群 提交于 2019-11-29 15:42:07
I have a Windows service application on Vista SP1 and I've found that users are renaming its executable file (while it's running) and then rebooting, thus causing it to fail to start on next bootup because the service manager can no longer find the exe file since it's been renamed. I seem to recall that with older versions of Windows you couldn't do this because the OS placed a lock on the file. Even with Vista SP1 I still cannot copy over the existing file when it's running - Windows reports that the file is in use - makes sense. So why should I be allowed to rename it? What happens if

Obtain filename from file pointer in C [duplicate]

狂风中的少年 提交于 2019-11-29 14:21:58
Possible Duplicate: Getting Filename from file descriptor in C How get fileName having FILE*? Is there any way where I can find the file_name from a file-pointer in C? fp = fopen(file,"r"); From fp, is it possible to get the file name which I have opened? I believe not, because a file* could be to something that doesn't even have a name. There might be a platform dependent way, depending I. Your system, so if you don't care about portability, try looking at your compiler's definition of FILE if it has one. Odds are that your only way is to save the name when it's opened. There are some other

ffmpeg output images filename with time position

放肆的年华 提交于 2019-11-29 11:45:56
I am using ffmpeg to get some jpg from my video at a specific rate (one screenshot every 5 seconds) with this command : ffmpeg -i source -f image2 -r 1/5 %d.jpg This works and give me sequential filenames : 1.jpg 2.jpg 3.jpg 4.jpg What if I need to know at which time those screenshots have been taken ? Something like a timestamp : 00:00:00.0000.jpg 00:00:05.0000.jpg 00:00:10.0000.jpg 00:00:15.0000.jpg or the number of seconds : 0.jpg 5.jpg 10.jpg 15.jpg I tried again with the new -frame_pts option : ffmpeg -i source -f image2 -r 1/5 -frame_pts 1 %d.jpg I got similar sequential filenames, but

Safe/Allowed filename cleaner for .NET

流过昼夜 提交于 2019-11-29 07:13:35
Is there any standardized / libraried / tested way in .NET to to take an arbitrary string and mangle it in such a way that it represents a valid file name? Rolling my own char-replace function is easy enough, but I'd like something a little more robust and resued. This problem is not as simple as you may think. Not only are the characters in Path.GetInvalidFileNameChars illegal, there are several filenames, such as "PRN" and "CON", that are reserved by Windows and cannot be created. Any name that ends in "." is also illegal in Windows. Moreover, there are various length limitations. Read the

java filenames filter pattern [duplicate]

白昼怎懂夜的黑 提交于 2019-11-29 06:45:15
This question already has an answer here: How to find files that match a wildcard string in Java? 16 answers I need to implement File[] files = getFiles( String folderName, String ptrn ); Where ptrn is a command prompt style pattern like "*2010*.txt" I'm familar with FilenameFilter class, but can't implement public boolean accept(File dir, String filename) because String.matches() doesn't accept such patterns. Thanks! The String#matches() accepts regular expression patterns . The regex variant of the "layman's" variant *2010*.txt would be .*2010.*\.txt . So the following should work: public

Python: getting filename case as stored in Windows?

ぐ巨炮叔叔 提交于 2019-11-29 05:55:21
Though Windows is case insensitive, it does preserve case in filenames. In Python, is there any way to get a filename with case as it is stored on the file system? E.g., in a Python program I have filename = "texas.txt", but want to know that it's actually stored "TEXAS.txt" on the file system, even if this is inconsequential for various file operations. Here's the simplest way to do it: >>> import win32api >>> win32api.GetLongPathName(win32api.GetShortPathName('texas.txt'))) 'TEXAS.txt' I had problems with special characters with the win32api solution above. For unicode filenames you need to

Delete Files with same Prefix String using Java

浪子不回头ぞ 提交于 2019-11-29 05:26:19
I have around 500 text files inside a directory with a same prefix in their filename say dailyReport_ . The latter part of the file is the date of the file. (For eg. dailyReport_08262011.txt , dailyReport_08232011.txt ) I want to delete these files using a Java procedure (I could go for a shell script and add it a job in the crontab but the application is meant to used by laymen). I can delete one single file using something like this try{ File f=new File("dailyReport_08232011.txt"); f.delete(); } catch(Exception e){ System.out.println(e); } but can I delete the files having a certain prefix

How to set filename containing spaces in Content-Disposition header

妖精的绣舞 提交于 2019-11-29 05:24:20
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? Use quotes: resp.addHeader("Content-Disposition", "inline; filename=\"" + fileName + "\""); According to the HTTP standard you surround the string with double-quotes, and escape any quotes or backslashes within by preceding them with a single backslash. Content-Disposition: attachment;

Git error: Malformed input or input contains unmappable chacraters

孤者浪人 提交于 2019-11-29 04:53:41
My Eclipse workspace has two projects, one using CVS, the other Git. When modifying a file in the CVS project and save, a pop-up window appear saying An internal error occurred during: "Computing Git status for repository repo23". Malformed input or input contains unmappable chacraters: /Users/pb/repo23/对照表/feng11.htm Any idea how to fix this? EDIT: Eclipse Platform Version: 4.3.1.v20130911-1000 Build id: M20130911-1000 Eclipse EGit 3.2.0.201312181205-r VonC You can see the exact call stack in this issue : java.nio.file.InvalidPathException: Malformed input or input contains unmappable