files

File system 'overlays'

Concrete use case: In the Eclipse IDE, new 'plugins' can be added by copying a plugin's file(s) into the $ECLIPSE_HOME/plugins directory. However, I want to keep my original Eclipse installation 'clean' without additional plugins because I want to run this basic installation on its own at times. What is a way of avoiding having to copy...

Search file in directory using complex pattern

I am looking for a C# library for getting files or directory from a directory using a complex pattern like the one used in Ant: dir1/dir2/**/SVN/* --> Matches all files in SVN directories that are located anywhere in the directory tree under dir1/dir2 **/test/** --> Matches all files that have a test element in their path, including t...

Changing Vim indentation behavior by file type

I have done some googling and I'm surprised that I haven't found this. COuld someone explain to me simply the easiest way to change the indentation behavior of vim based on the file type? For instance if I open a python file it would indent with 2 spaces, but if I open powershell it would use 4 spaces. ...

How would you implement ant-style patternsets in python to select groups of files?

Ant has a nice way to select groups of files, most handily using ** to indicate a directory tree. E.g. **/CVS/* # All files immediately under a CVS directory. mydir/mysubdir/** # All files recursively under mysubdir More examples can be seen here: http://ant.apache.org/manual/dirtasks.html How would you implement this i...

Reading very large files in PHP

fopen is failing when I try to read in a very moderately sized file in PHP. A 6 meg file makes it choke, though smaller files around 100k are just fine. i've read that it is sometimes necessary to recompile PHP with the -D_FILE_OFFSET_BITS=64 flag in order to read files over 20 gigs or something ridiculous, but shouldn't I have no prob...

What is the command line syntax to delete files in Perforce?

I am creating some build scripts that interact with Perforce and I would like to mark for delete a few files. What exactly is the P4 syntax using the command line? ...

Problem using the ASP.NET FileUpload control in an UpdatePanel?

I'm running into an issue where I have a FileUpload control in an UpdatePanel. When I attempt to save changes and upload the file, no file is found. If I remove the UpdatePanel everything seems to work fine. Any ideas why this might be happening? And is there a work-around? ...

Best generic strategy to group items using multiple criteria

Hello, I have a simple, real life problem I want to solve using an OO approach. My harddrive is a mess. I have 1.500.000 files, duplicates, complete duplicate folders, and so on... The first step, of course, is parsing all the files into my database. No problems so far, now I got a lot of nice entries which are kind of "naturaly groupe...

Easiest way to get file's contents in C

What is the simplest way (least error-prone, least lines of code, however you want to interpret it) to open a file in C and read its contents into a string (char*, char[], whatever)? ...

How do I convert a file's format from Unicode to ASCII using Python?

I use a 3rd party tool that outputs a file in Unicode format. However, I prefer it to be in ASCII. The tool does not have settings to change the file format. What is the best way to convert the entire file format using Python? ...

How do I change read/write mode for a file using Emacs?

If a file is set to read only mode, how do I change it to write mode and vice versa from within Emacs? ...

Signature files for document retrieval

Hi all, I was wondering if you know somewhere where I can find information on how to build a signature file for docuement retrieval. Do you know if there is some code out there that I can use or look at? I have to create a signature file in C++ under linux platform. UPDATE: Sorry, I appreciatte the help but I was refering to signature ...

Best Way to Write Bytes in the Middle of a File in Java

What is the best way to write bytes in the middle of a file using Java? ...

How can I monitor a directory for newly uploaded files?

I need to create a windows service that will monitor a directory for newly uploaded files. The files will be around 100K to 400K in size. Is there a chance that my monitoring system will notice a new file, but the file hasn't completetly finished copying over? i.e. it is still streaming in and the EOF hasn't been written yet? ...

What Win32 API can be used to find the process that has a given file open?

If I read or write to a file and receive a 33 or 32 error, I would like to log a message containing the name of the other process(es) that have the file opened. There must be a Win32 API I could use to get this info. Process Explorer displays it. Of course, Process Explorer also has info about all processes in memory. I'd prefer to find ...

PHP 5.x syncronized file access (no database)

Hi, I'm mostly familiar with Java, C and C++ in which there are ways to control that only one thread is accessing a resource at any given time. Now I'm in search for something similar but in PHP 5.x. To formulate my problem with one example: I have an ASCII-file which only stores a number, the value of a page load counter. At applicat...

.Net: Open File From URL

In ASP.Net, I have an XML file (within my project) that I would like to deserialize. FileStream objects do not allow you to open a file via URL. What is the easiest way to open the file so I can deserialize it? ...

What is the best way to open a file for exclusive access in Python?

What is the most elegant way to solve this: open a file for reading, but only if it is not already opened for writing open a file for writing, but only if it is not already opened for reading or writing The built-in functions work like this >>> path = r"c:\scr.txt" >>> file1 = open(path, "w") >>> print file1 <open file 'c:\scr.txt',...

How to scan a folder in Java?

How can I get a tree of all the files from a current folder in Java? ...

How to convert a file to utf-8 in Python?

I need to convert a bunch of files to utf-8 in Python, and I have trouble with the "converting the file" part. I'd like to do the equivalent of: iconv -t utf-8 $file > converted/$file # this is shell code Thanks! ...