filenames

Save information from sprintf to a variable

孤人 提交于 2019-12-11 16:21:13
问题 is it possible to save information gather from a sprintf into a variable? The lines of code below are an example to better illustrate my question. char fileName; fileName = sprintf(command, "find -inum %i -type f", iNode); The purpose is to find the file name associated with the inode number, then run "stat" on that file name. 回答1: I think you want something like this: FILE *fp; char cmd[1024]; char filename[1024]; sprintf(cmd, "find -inum %i -type f", iNode); fp = popen(cmd); fgets(filename,

Windows batch to keep the newest N files based on the timestamp in filename

£可爱£侵袭症+ 提交于 2019-12-11 15:57:46
问题 I need a batch script to keep only the newest N files based on the timestamp from filename and only if the size is bigger than 150 KB (if the size is less, means the backed up file is damage and can be deleted). I found similar scripts but only for Linux. The script should first delete all the files with size less than 150 KB and keep the newest N files using as reference the timestamp from filename not the modified date of the files. This .txt file is modify a few times per day except the

rewrite URL to affect “save as” filename

谁说胖子不能爱 提交于 2019-12-11 15:49:09
问题 My application is in JSP/Struts and running on WebSphere. I don't have access to the server /really/ so I'm trying to do all this from within the app itself (Struts actions & config, JSP, etc). I have a page that displays links for PDF documents that the user might want to look at. When they click on the link, it is forwarded to the 'document view' STRUTS action which performs the work to retrieve the PDF from the back-end system and then displays the PDF in the browser window. This all works

Filename manipulation in cygwin

…衆ロ難τιáo~ 提交于 2019-12-11 12:26:49
问题 I am running cygwin on Windows 7 . I am using a signal processing tool and basically performing alignments. I had about 1200 input files. Each file is of the format given below. input_file_ format = "AC_XXXXXX.abc" The first step required building some kind of indexes for all the input files, this was done with the tool's build-index command and now each file had 6 indexes associated with it. Therefore now I have about 1200*6 = 7200 index files. The indexes are of the form given below.

PHP: How to write file to disk with unicode characters

孤街醉人 提交于 2019-12-11 12:16:29
问题 I need to write out a file to disk with special ISO-8859-15 characters. For my own testing purposes, I used: —©®±àáâãäåæÒÓÔÕÖ¼½¾§µçðþú–.jpg ...but the em-dash, en-dash, and the 1/2, 1/4, and 3/4 fractions were replaced with garbage when the file was written to disk with this name, while the other characters in the file name were written out correctly. Why some and not others??? Here is a very simple PHP script to write out a file with just copyright symbols and em-dashes in its name. When I

PHP - Windows - filename incorrect after upload (ü saved as ü etc.)

走远了吗. 提交于 2019-12-11 11:36:36
问题 I have this home made app that allows multiple file uploads, I pass the files to php with AJAX, create new dir with php, move there uploaded files and save the dir location to database. Then to see the files I run listing of the directory location saved in the db. The problem is that files come from all around the world so very often they have some non latin characters like for example ü. When I echo the filename in php names appear correctly even when they have names written in Arabic, yet

APEX dynamically define default filename?

Deadly 提交于 2019-12-11 10:58:16
问题 In an APEX application, I have an interactive report. In Report Attributes > Report Export > Filename , you can specify what file name you the download to have as a default. Question: Is there a way to dynamically define this default filename? Yes, I know, the user can change it when they do the download. But my boss wants the user to not to have to change the file name. What can anyone tell me? Thanks!! APEX 4.2 Windows 7 IE 11 回答1: Yes you can do this. Create a hidden page item (e.g. P1

What does getNameCount() actually count?

时间秒杀一切 提交于 2019-12-11 10:21:51
问题 My question has two parts - First, exactly what the title is - What is the Path.getNameCount() method actually counting? I read the little popup information that comes with it when you select a method in Eclipse, and I thought that this was an appropriate usage. This method I've created utilizing it is returning 5 as the int when it's run. Secondly, what I'm trying to do is return how many files are in the target directory so that I can run the other method I have to retrieve file names an

Increment image name if already exists

走远了吗. 提交于 2019-12-11 09:51:19
问题 I'm using following code format to change image name if it already exists on server. I want incremental image names if they already exist with the same name. Ex: abc.png , abc_1.png , abc_2.png function file_newname($path, $filename){ if ($pos = strrpos($filename, '.')) { $name = substr($filename, 0, $pos); $ext = substr($filename, $pos); } else { $name = $filename; } $newpath = $path.'/'.$filename; $newname = $filename; $counter = 1; while (file_exists($newpath)) { $newname = $name .'_'.

Batch script for copying files based on name

不羁的心 提交于 2019-12-11 07:46:07
问题 Basically I want to write a little batch script that does the following - I have two folders, A and B... A has 10 files and B has 100. I want to compare the names of the files in each folder and if any in B have the same name as in A, then to copy them to folder A and overwrite the original file. I was trying to start off by doing a "for" command on folder A but then I would have to follow that with an IF to compare the filenames which I have no idea how to express correctly for /r "C: