files

How do I write file modification dates programmatically in POSIX?

Hello. I would like to touch my files from C code to modify their access date. This does not seem to work: struct stat fileSt; lstat(path, &fileSt); fileSt.st_mtime = time(NULL); Thank you for help. ...

Building PHP uploader for gif/jpg/png/pdf/doc, wmv files, feasible, or should I buy something?

I've got a Mac server and I'm building PHP code to allow users to upload images, documents, and even video files. Researching this has definitely gotten me nervous, I want the uploaded content to be virus free. Is building something myself going to be a huge challenge? Would you do it, or would you find some OS or OTS product? (And do ...

Bash: Recursively adding subdirectories to the path

... How do you do it? My code/ directory at work is organized in folders and subfolders and subsubfolders, all of which (at least in theory) contain scripts or programs I want to run on a regular basis. Its turning my otherwise picturesque .bashrc into an eyesore! Thanks! ...

How to invoked methods of external .h files in iphone

Hi to all In my iphone game I want to add external .h and .a files. I am adding them by using add project option given in Xcode. It get added but I want to invoked the methods given in the header files. As per instruction given to us we have to call one method which is declared in external header file. We have to call that method insi...

How to find common strings among two very large files?

I have two very large files (and neither of them would fit in memory). Each file has one string (which doesn't have spaces in it and is either 99/100/101 characters long) on each line. Update: The strings are not in any sorted order. Update2: I am working with Java on Windows. Now I want to figure out the best way to find out all the s...

Session and app pool: an ASP.NET app that stores and displays images

I have a .NET app that allows users to upload images to a directory within the webapp and then view them. The problem is that the session gets lost when I upload or delete an image in the webapp directory. It seems that the app pool is getting recycled when I add images, and not just config or cs files. I have seen this technique used i...

Get the hierarchy of a directory with PHP

I'm trying to find all the files and folders under a specified directory For example I have /home/user/stuff I want to return /home/user/stuff/folder1/image1.jpg /home/user/stuff/folder1/image2.jpg /home/user/stuff/folder2/subfolder1/image1.jpg /home/user/stuff/image1.jpg Hopefully that makes sense! ...

parse directory name from full filepath in C#

If i have a string variable that has: "C:\temp\temp2\foo\bar.txt" and i want to get "foo" what is the best way to do this? ...

saving a file and automatically create directories

i am concatenating a number of variables and i want to save that string as a file path. is there a way it will automatically create all appropriate directories if they dont exist without having to check "if exists" on each one for example . . "C:\" + a + "\" + b+ "\" + d + "\" + d + ".txt" ...

Ruby show progress when copying files

I'd like to be able to show the progress of a file copy operation when copying files using Ruby (currently using FileUtils.cp) I've tried setting the verbose option to true but that just seems to show me the copy command issued. I'm running this script from command line at the moment so ideally I'd like to be able to present something l...

Best/Easiest/Quickest way to get relative path between two files?

I'm in the midst of some refactoring some C# code and part of this is to redo some references, because we're redoing the folder structure entirely. What I'd like to do is just go into the .csproj or .sln file and modify the paths. However some of the references have paths like "../../../../../../ThirdParty/SomeMicrosoftLibrary/bin/Debu...

Determine if a file can be moved or copied

Besides trying the operation and catching the exception, is there a method to determine if a file can be moved or copied? ...

Mac 10.4 Sync Files

I am using Google code svn and have a repository setup. Inside the repository I am including TinyMCE and now I want to upgrade all the files in this folder. The problem I am having is if I checkout locally and then download their new version and replace the folder it wipes out all my svn files. So in effect removes it from version cont...

How to get all files in a directory with certain extension in C#?

I am using this to get all files in a directory: string[] files = Directory.GetFiles(sourceDirectory_); But is there a way to get all files that end with "jpg" in one line without doing an if (file.endswidth("jpg") check? ...

File comparison in C#

Is there any in-built class/method for comparing content of two audio/ video files? Or is there any in-built class/method for converting a audio/video file to bit stream? ...

ASP.NET: Location for storing files that should be shared between several web-applications

I have two web-applications. One is an outwards-facing application that will be accessible from the internet. The other is an application to manage the first, that will only be accessible from the intranet. They keep their data in files on the filesystem (I think a database would be overkill for these applications). The management-appl...

How to read from an os.pipe() without getting blocked?

I'm trying to read from an open os.pipe() to see if it's empty at the moment of the reading. The problem is that calling read() causes the program to block there until there is actually something to read there however there won't be any, if the test I'm doing succeeded. I know I can use select.select() with a timeout however I wanted t...

How do I get the directory from a file's full path?

What is the simplest way to get the directory that a file is in? I'm using this to set a working directory. string filename = "C:\MyDirectory\MyFile.bat" In this example, I should get "C:\MyDirectory". ...

How do I search a directory of files using another file as input and sending the output to another file?

I am working on a Unix system. I have a directory of files called MailHistory. Each file in the directory contains all of the emails for the previous day. The files are created at midnight and named with the timedatestamp. So, a typical filename is 20090323000100. I have a file that has a list of names. Using this file as input, I...

Write to Directory using PHP: Is this a permissions problem?

Hi My PHP script writes to a file so that it can create a jpg image. fwrite($handle, $GLOBALS['HTTP_RAW_POST_DATA']); fclose($handle); print $newfile.'.jpg'; I have put this script on a new server however the image never gets saved. The permission of the folder it saves to is 755 but it does not own it. Last time, I think I fixed...