files

How can I record changes made during in-place editing in Perl?

I've scripted up a simple ksh that calls a Perl program to find and replace in files. The passed-in arg is the home directory: perl -pi -e 's/find/replace/g' $1/*.html It works great. However, I'd like to output all the changes to a log file. I've tried piping and redirecting and haven't been able to get it work. Any ideas? Thank...

how to sort list of FileInfo in IronPython

Given a list of FileInfo objects, how do I sort them by date? Specifically I want to sort them by CreationTime in descending order. ...

How can I get a list of files in a directory using C or C++?

How can I determine the list of files in a directory from inside my C or C++ code? I'm not allowed to execute the 'ls' command and parse the results from within my program. ...

Linux: Removing files that don't contain all the words specified

Inside a directory, how can I delete files that lack any of the words specified, so that only files that contain ALL the words are left? I tried to write a simple bash shell script using grep and rm commands, but I got lost. I am totally new to Linux, any help would be appreciated ...

What is the best way to associate a file with a piece of data?

I have an application that creates records in a table (rocket science, I know). Users want to associate files (.doc, .xls, .pdf, etc...) to a single record in the table. Should I store the contents of the file(s) in the database? Wouldn't this bloat the database? Should I store the file(s) on a file server, and store the path(s) in t...

Keep a log of file access time

So we have a few (or more, no one knows) apps written by someone who has now left, these apps access Microsoft Access Databases stored on this developers old PC, which in turn read from our Production SQL database. Now to track all these programs down, and what time they are run, I'd like to keep a log of a files access time, is this pos...

Best way to pass a file to a function

I'm working on a VB.NET DLL right now, and one of the functions I'm writing is supposed to take a file, and clip out an array of bytes (the method I've got works, and can be abstracted away here). What's the best way to pass a file to this function? Would passing a filename to it be best, or what would be the best way to accomplish thi...

C# database in a file

How do i create a db file in C#? a friend told me it was in the toolbox and not to use sqlite. I dont see anything that could be it, nor what it is called. google didnt help:( ...

Having a lot of trouble deploying a java applet

I'm new to Java. I'm simply trying to build a .jar file of my applet so I can run it from my browser. This is what my directory structure looks like: C:\java\pacman\src contains all of the .java class files. C:\java\pacman\assets contains about 4-5 images and audio files. If I try to use the following code: Image someFile=getCod...

What is the fastest way to read a large number of small files into memory ?

I need to read ~50 files on every server start and place each text file's representation into memory. Each text file will have its own string (which is the best type to use for the string holder?). What is the fastest way to read the files into memory, and what is the best data structure/type to hold the text in so that I can manipulate...

XSLT: How to get file names from a certain directory?

Is there a function in XSLT that can takes in a directory path and gives back all the files in it?? I have a xml file now reads like this <filelist> <file>fileA.xml</file> <file>fileB.xml</file> </filelist> Now, there's directory called dir, has files fileX.xml, fileY.xml and a bunch of other xml files in it. I want to add th...

Batch rename files using directory name with Regular Expression

Given the following file/directory structure: /photos/1/original/filename1.jpg /photos/1/thumb/filename1.jpg /photos/2/original/filename2.jpg /photos/2/thumb/filename2.jpg /photos/3/original/filename3.jpg /photos/3/thumb/filename3.jpg ...etc. I'm looking for the regexp to convert the file/directory structure to: /photos/1/original.jp...

Rename files, Python/Jython

I have a directory full of files, some which have an ampersand in their names. I would like to rename all the files with ampersands and replace each ampersand with a plus (+). I am working with around 10k files. What would be the best method to do this? ...

What is the maximum number of files limit?

What is the maximum number of files limit in this code? FIX: Common File Dialog Multiple Selection File Limit http://support.microsoft.com/kb/179372 ...

How do I sum together file sizes in bash, grouping together the results by date?

On a Linux server that I work with, a process writes randomly-named files at random intervals. Here's a small sample, showing the file size, modification date & time, and file name: 27659 2009-03-09 17:24 APP14452.log 0 2009-03-09 17:24 vim14436.log 20 2009-03-09 17:24 jgU14406.log 15078 2009-03-10 08:06 ySh14450....

Are there any Java Frameworks for binary file parsing?

My problem is, that I want to parse binary files of different types with a generic parser which is implemented in JAVA. Maybe describing the file format with a configuration file which is read by the parser or creating Java classes which parse the files according to some sort of parsing rules. I have searched quite a bit on the internet...

How to dectect new or modified files in Mac OSX

In Windows OS, MS provides ReadDirectoryChangesW and FindFirstChangeNotification API to dectect new or modified file, does the Mac OSX provide equal function as well? ...

The device is not connected exception

I try to open a large number of files but after 5000 files or so I get Exception in thread "Main" java.io.IOException: The device is not connected Is this the expected behavior? Is there a way around it? I want to leave my code as straightforward as possible. ...

Directory checksum with python?

So I'm in the middle of web-based filesystem abstraction layer development. Just like file browser, except it has some extra features like freaky permissions etc. I would like users to be notified somehow about directory changes. So, i.e. when someone uploads a new file via FTP, certain users should get a proper message. It is not re...

How can you break on handle creation?

I have an application that spawns multiple child processes. Before launching a child, I create stdOut and stdErr handles to a log file (for example, if I am about to launch procA, i create handles to logA.log). I set these handles on the child processes. By looking with ProcExplorer, I can see that each child process has handles to eac...