files

Renaming a set of files to 001, 002, … php

I have a set of images in a folder call 'uploads/', all the files are in this form 5f0f905706.jpg, 15758df106.jpg, ... I want to rename them as is, 001.jpg, 002.jpg, 003.jpg ... how i code this? thanks ...

Why do I get this error "EMCIDeviceError" when opening some wav files in my program.

Hey I have this program that has been working fine until I tried to open this one wav file? Not sure what the problem is or that I understand it? Do I need to find a new component to use for this file or what? I am using Delphi 4 Pro and the standard VCL component for Media Player. I am looking for a good new component that offers mo...

git - how to recover the file permissions git thinks the file should be?

I have a git checkout. All the file permissions are different than what git thinks they should be therefore they all show up as modified. Without touching the content of the files (just want to modify the permissions) how do I set all the files permissions to what git thinks they should be? ...

How to group files by date using PowerShell?

I have a folder with 2000+ files. I want to count the files by date. so with: Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 2010-03-15 12:54 AM 10364953 file1.txt -a--- 2010-03-15 1:07 AM 10650503 file2.txt -a--- 2010-03-16 1...

Save output of a php file in a html file..

I am having a php file which executes some code to generate a html file.Its like I m having a form from which some data will be posted to x.php file, which gives a output(a webpage). I want to save that output in a html file.What the most efficient way of doing this.? EDIT I want to save it on sever side. Actually the thing is i want to...

What's the fastest way using lsof to find a single open file?

I'm trying to test a single file if it is open using lsof. Is there a faster way than this? $result = exec('lsof | grep filename | wc -l'); if($result > 0) { //file is open } I'm thinking their must be a way to just test for one file if you know the filename. All I really need is a true or false. ...

Rails - number of rows in a file

Hey. How can I get a total number of rows in a file (do not want to do it with loop). I'm reading CSV file. Example 1 CSV.open('clients.csv', 'r') Example 2 FasterCSV.foreach('clients.csv') Thx. ...

How to append to the beginning of a text fle in g++

I want to write to a file without overwriting anything. It is a text file containing records. When I delete a specific record, I do not actually remove it from the file, I just put information in the header saying that it is deleted. How can I do this? ...

Is modifying a file without writing a new file possible in c++?

Let's say I have a text file that is 100 lines long. I want to only change what is in the 50th line. One way to do it is open the file for input and open a new file for output. Use a for-loop to read in the first half of the file line by line and write to the second file line by line, then write what I want to change, and then write o...

Automatically open files given as command line arguments in Python

I have a lot of Perl scripts that looks something like the following. What it does is that it will automatically open any file given as a command line argument and in this case print the content of that file. If no file is given it will instead read from standard input. while ( <> ) { print $_; } Is there a way to do something sim...

Injecting property values via Spring by Environment

I have a Property File like this: frame.server.dev=mark.is.cool frame.server.test=chris.is.cool frame.server.qa=mitch.is.cool frame.server.prod=cory.is.cool I need to inject the correct value based on the environment. Since we have one ear file that we move from environment to environment, I need to do something like this: <util:pro...

GNU make copy files to distro directory

I keep my source html (and images etc.) in separate directories for source control. Part of making the distro is to have make copy files to output folder and set the attributes. Today my makefile shows (extract): %.html: /usr/bin/install -c -p -m 644 $< $@ www: $(HTMLDST)/firmware.html $(HTMLDST)/firmware_status.html $(HTMLDST)/i...

2 Files, Half the Content, vs. 1 File, Twice the Content, Which is Greater?

If I have 2 files each with this: "Hello World" (x 1000) Does that take up more space than 1 file with this: "Hello World" (x 2000) What are the drawbacks of dividing content into multiple smaller files (assuming there's reason to divide them into more files, not like this example)? Update: I'm using a Macbook Pro, 10.5. B...

Using inotify-tools and ruby to push uploads to Cloud Files - SOLVED

Hi Guys, I wrote a few scripts to monitor an uploads directory for changes, then capture the file uploaded/changed and push it to cloud files using a ruby script. This all works well 95% of the time, the only exception is that occasionally, ruby fails with a 'file does not exist' exception. I am assuming that the ruby 'push' script is ...

Writing to file VB6 without new line?

I have some strings I want to write to a file in VB6, I can write it fine but every time I do it adds a new line automatically after each write command. Is there a function or a way to just write to the file without the automatic new line? Thanks. ...

Why touching "d_name" makes calls to readdir() fail?

Hi, I'm trying to write a little helper for Windows which eventually will accept a file extension as an argument and return the number of files of that kind in the current directory. To do so, I'm reading the file entries in the directories and after getting the extension I'd like to convert it to lowercase to compare it with the yet-to...

How to easily upload files without form submission (with jQuery + AJAX)

So I have some form processing code which processes the standard text inputs and also uploaded files (through the $_FILES array) I want to have the submission done through AJAX Will jQuery's post(). method still pass that stuff through -> $_FILES or do I need to do something special? ...

How can I copy files with names containing spaces and UNICODE, when using a shell script?

I have a list of files that I'm trying to copy and move (using cp and mv) in a bash shell script. The problem that I'm running into, is that I can't get either command to recognize a huge number of files, seemingly because the filenames contain spaces and/or unicode characters. I couldn't find any switches to decode/re-encode these cha...

Mercurial/.hgignore - How do I ignore everything but the contents of a folder?

I have a NetBeans project and the Mercurial repository is in the project root. I would like it to ignore everything except the contents of the "src" and "test" folders, and .hgignore itself. I'm not familiar with regular expressions and can't come up with one that will do that. The ones I tried: (?!src/.*) (?!test/.*) (?!^.hgignore)...

visual studio localhost server can't locate file

i have a very simple web project. just one htm file with some javascript that opens a file test.xml. the xml file is in the same folder as the htm file (and it is part of the project) but when i start the page (f5 or ctrl-f5) it can't find the xml. it starts as http://localhost:50586/main.htm when i do a folder list the test.xml file i...