files

detect new or modified files with python

I'm trying to detect when a new file is created a directory or when an existing file is modified in a directory. I tried searching for a script that would do this (preferably in python or bash) but came up short. My environment is linux with Python 2.6 Related Questions: http://stackoverflow.com/questions/415856/how-to-detect-new-or-m...

Atomic delete for large amounts of files

I am trying to delete 10000+ files at once, atomically e.g. either all need to be deleted at once, or all need to stay in place. Of course, the obvious answer is to move all the files into a temporary directory, and delete it recursively on success, but that doubles the amount of I/O required. Compression doesn't work, because 1) I don...

How to delete files with exclamation marks! using emacs' delete-file

I'm trying to make emacs' delete-file function delete files with exclamation marks in their names. The particular use case is that I have set emacs to save all backup files in a single directory and to delete old backup files. However, when all backup files are placed in one directory, the directory separator / is replaced with !. When ...

Files in domain model

What are the best practices for dealing with binaries in domain model? I frequently must associate images and other files with business objects and the simple byte[] is not adequate even for the simplest of cases. The files: Does not have a fixed size and can be quite large thus: Have to be streamed or buffered, preferably in asynchr...

Easiest way to read/write a file asynchronously?

I am looking for a simple way to read/write a file asynchronously using Win API. What I had is mind is something like the asynchronous winsock API (WSAxxx) completion routines. However the file API doesn't seem to have those. Are they hidden somewhere? Waiting on the overlapped events in a seperate thread adds thread management overhead...

I am downloading a file using Python urllib2. How do I check how large the file size is?

And if it is large...then stop the download? I don't want to download files that are larger than 12MB. request = urllib2.Request(ep_url) request.add_header('User-Agent',random.choice(agents)) thefile = urllib2.urlopen(request).read() ...

Getting size of a file in D2010?

Delphi 2010 has a nice set of new file access functions in IOUtils.pas (I especially like the UTC versions of the date-related functions). What I miss so far is something like TFile.GetSize (const Path : String) What is the Delphi 2010-way to get the size of a file? Do I have to go back and use FindFirst to access TSearchRec.FindData?...

How to enable git file tab completion with zsh compinit?

I have a problem with the zsh tab completion: After running: autoload -U compinit compinit Git tab completion for files does not work any more. For example if I type git add my_f to complete my_file, nothing happens. The zsh git completion only seems to work for git branches and tags. Without the compinit stuff, git file completion wo...

Sending file contents in $_POST with PHP

Hi, I'm developing a PHP script to send the content of a file from one script to another. In PHP usually it's used the $_FILE array that contains any uploaded file submitted in a form. But I didn't needed a form so I came up with something a little different: // pseudo function names ahead $content = file_get_contents(FILE_TO_SEND); s...

Simple upload/download form in ASP.NET MVC

I'm getting started with ASP.NET MVC, but would like to explore further. I've walked through the usual "hello, world" examples, and now I'd like to try something a little more complex. Specifically, I want to be able to: upload some XML file, do some simple processing on it, and then allow the user to download a new file with the resul...

Ouput file redirection in Python

I'm writing a backup script I intend to execute in a cronjob every night. The script sets sys.stdout and sys.stderr to an output file to keep a log of what happens. To do the backup I use the following code cmd = 'rsync -av --del --stats --filter "- .thumbnails/" ' + \ '--filter "- *~" --filter "- *.iso" --filter "- lost+found/" ...

Too many open file handles

I'm working on a huge legacy Java application, with a lot of handwritten stuff, which nowadays you'd let a framework handle. The problem I'm facing right now is that we are running out of file handles on our Solaris Server. I'd like to know what's the best way to track open file handles? Where to look at and what can cause open file ha...

Reading a file into an array

I would like to read a text file and input its contents into an array. Then I would like to show the contents of the array in the command line. My idea is to open the file using: inFile.open("pigData.txt") And then to get the contents of the file using: inFile >> myarray [size] And then show the contents using a for loop. My prob...

Need a good files creation tool...

I want to create a test setup which should have a 4tb of High density filesystem. I've tried some tools(wst) but they are crashing after sometime. After struggling for two days im able to fill not even 20% of disk space. I need this tool on windows. Any suggestions? ...

Where does Python first look for files?

I'm trying to learn how to parse .txt files in Python. This has led me to opening the interpreter (terminal > python) and playing around. However, I can't seem to be able to specify the right path. Where does Python first look? This is my first step: f = open("/Desktop/temp/myfile.txt","file1") This blatantly doesn't work. Can an...

Java: Generate a Powerset

This could be language agnostic/helpful answers could just be in pseudo-code. I have a program that I would like to test under a range of inputs. This program takes a set of files, one of which is designated as the root. I want to run the program with all possible subsets of files. (Two subsets, containing the same files, but with diffe...

Writing a binary file in C# to be read by C program, with pointers?

I'm moving some old C code that generates a binary file into our C# system. The problem is, the resulting binary file will still need to be read by another old C program. The original code outputs several structs to a binary file, and many of those structs contain linked lists, with *next pointers. How can I write these in C# so that ...

Copying file to client machine

Hi We have a requirement to copy a .txt file into the client machine and open the file using notepad.exe. We develop our application using MS Visual Studio 2008 VB .Net. Any experencied this kind of requirement? Help required... Thanks Shoba Anandhan ...

HttpWebRequest C# uploading a file

Hello, using C#, I'm trying to integrate my web store w/ an email marketing client. I want to upload a comma delimited file of subscribers once a night. They say to get this to work, it has to be a form posts: multipart/form-data, but I'm not using a form. I'm able to connect to their servers but I keep getting back a Data can't be blan...

Is "34KB" or "34 KB" more correct?

When I am displaying a file size to a user, is "34KB" or "34 KB" more correct? ...