file

Check if a file is open from another process

How do I check if a file is already used by another process from Powerscript ? ...

Read and Write in Word file using Visual studio 2005

How to read and write a MS word file in VB.net or C# .net ...

Verify if file exists or not in C#

Hi, I am working on an application. That application should get the resume from the users, so that I need a code to verify whether a file exists or not. I'm using ASP.NET / C#. Thanks, Suresh Kumar ...

Java file locking on a network

This is perhaps similar to previous posts, but I want to be specific about the use of locking on a network, rather than locally. I want to write a file to a shared location, so it may well go on a network (certainly a Windows network, maybe Mac). I want to prevent other people from reading any part of this file whilst it it being written...

Mirroring console output to a file

In a C# console application, is there a smart way to have console output mirrored to a text file? Currently I am just passing the same string to both Console.WriteLine and InstanceOfStreamWriter.WriteLine in a log method. ...

In C# check that filename is *possibly* valid (not that it exists)

Is there a method in the System.IO namespace that checks the validity of a filename? Example: 'C:\foo\bar' would validate ':"~-*' would not a little trickier: 'X:\foo\bar' would validate is there is an X: drive on the system, but wouldn't otherwise. I suppose I could write such a method myself, but I'm more interested in a built-in on...

Best way to instantly mirror/sync files from Windows to Linux server

I have a directory on a Windows machine with a large number of files and folders that I need to watch and have the files mirrored/synced instantly (or as near to as possible), to a Linux machine over the local network. I've investigated: - Rsync, not realtime enough - WinSCP 'Keep directories up to date' feature, which was OK but limite...

Using DOS Prompt and via' FTP copying files on to the server

Hi Guys, I would like when we Copy files on to the server via FTP the size of the file changes. What is the reason behind this. Does the change in the file size can make the files corrupt and the FTP process Fails ? ...

What is the best/simplest way to read in an XML file in Java application?

Currently our Java application uses the values held within a tab delimited *.cfg file. We need to change this application so that it now uses an XML file. What is the best/simplest library to use in order to read in values from this file? ...

Win32 equivalent of opendir

Would anyone know what the Win32 equivalent of opendir is (or if it even exists) ? Obviously I could use FindFirstFile(Ex) with FindNextFile, but appending * to the path seems like such a hackish way to do it. ...

Why would subversion timeout when I try to commit changes to a directory?

When attempting to commit file in the jsunit directory in my working-copy, I waited a really long time and got an error like: svn: OPTIONS request failed on '/svn_repo/OSB_Project/trunk/OSB/test/web/jsunit' svn: timed out waiting for server Why would the server hang at this point? Running SuSE 10.3 in a VirtualBox where I keep my Sub...

Best way to read in a rolling log file in .NET?

Hi folks, i need to read in a rolling log file in .NET 3.5sp1. I'm wondering what's the best way to do this? The file can get really big. An idea i had was to Open File Read file to last read line (in the first case, it was 0) Read all remaining lines Close stream and remember the last line number read. Wait a bit. Rinse/repeat. i'm...

Recursive File Search in .net

Hi, I need to search a drive (C:, D: etc) for a partuicular file type (extension like .xml, .csv, .xls). How do I preform a recursive search to loop all directories and inner directories and return the full path of where the file(s) are? or where can I get information on this? VB.NET or C# Thanks Edit ~ I am running into some errors ...

Doubt in C++ file handling

Following code, when compiled and run with g++, prints '1' twice, whereas I expect '1' to be printed only once, since I am dumping a single structure to the file, but while reading back it seems to be reading two structures. Why? #include <iostream.h> #include <fstream.h> int main(){ struct student { int rollNo; }; ...

Java sort String array of file names by their extension

I have an array of filenames and need to sort that array by the extensions of the filename. Is there an easy way to do this? ...

How to delete files via FTP when directory has over 100,000 files?

I went to upload a new file to my web server only to get a message in return saying that my disk quota was full... I wasn't using up my allotted space but rather my allotted FILE QUANTITY. My host caps my total number of files at about 260,000. Checking through my folders I believe I found the culprit... I have a small DVD database a...

How do I replace the contents of an existing XML file in C#.NET?

When trying to replace the content of an XML file in C#.NET with a snippet like this: string file = Path.GetTempFileName(); // pretend this is a real file string tmpFile = Path.GetTempFileName(); using (var writer = XmlWriter.Create(File.Create(tmpFile))) { writer.WriteStartElement("root"); for (int i = 0; i < 100; i++) { ...

issue with FILE

I'm getting the folowing error for below code, "1506-221 (S) Initializer must be a valid constant expression" FILE *fp[] = {stdout, dump_f}; is this acceptable? what is the proper way to achive this? ...

vbscript / Classic ASP - Is there any way to get your own file name programmatically?

I was just reviewing some old code and found the following (inside foo.asp): Const ASP_FILENAME = "foo.asp" ' TODO: Update this to the name of this file (if changed) The variable is only used for logging errors. (ie. "Error in foo.asp - Could not create xxxxx object.") Is there any way to avoid this? Thanks! ...

How do I re.search or re.match on a whole file without reading it all into memory?

I want to be able to run a regular expression on an entire file, but I'd like to be able to not have to read the whole file into memory at once as I may be working with rather large files in the future. Is there a way to do this? Thanks! Clarification: I cannot read line-by-line because it can span multiple lines. ...