file-io

Watch for files in a folder in VB.net

I need to watch a folder in our network and if any files get dropped in any time of the day I need to ftp to a different folder. What do you think is a feasible approach? Please post links if you have any that will take me in right direction. ...

Get Project or Relative Directory with T4

How can I get a reference to the directory of the visual studio project or solution or the directory of the t4 template from within a t4 template? I have a template that concatenates a number of files together which are located relative to the template. I need to get a reference to there absolute location through a relative means. Hard ...

Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on.

Hello, I am writing a filewatcher windows application which will look for changes in a specified folder and then logs the details in a txt file. I followed exactly what is mentioned in this article below http://www.codeproject.com/KB/dotnet/folderwatcher.aspx When I hit F5 from my application and then create or modify a file in the fo...

Purpose of ibs/obs/bs in dd

I have a script that creates file system in a file on a linux machine. I see that to create the file system, it uses 'dd' with bs=x option, reads from /dev/zero and writes to a file. I think usually specifying ibs/obs/bs is useful to read from real hardware devices as one has specific block size constraints. In this case however, as it i...

How to access the file system from an EJB 3?

Hello, I would like to know how can I access the file system from an EJB 3 bean? I searched the Internet on the subject and haven't found a good answer. Some suggest using the java.io/java.nio even though the specification prohibits this usage. Most application servers seem to allow the access to this API anyway. Another idea would b...

Best way to display output of pattern search on text files?

Hi, first question here! I'm writing a grep type program for Windows, just for fun (using Mingw). It works well for text files where lines are terminated by '\n'. I'm using fstream::getline() for this. But I also need to be able to search files containing just a giant block of text with no line numbers. fstream::getline() fails here. I...

Java Desktop API not working with network paths?

I am trying to use the Desktop API to launch the appropriate app for a file. So i am using this : if (Desktop.isDesktopSupported()) Desktop.getDesktop().open(new File(path)); where "path" is a String pointing to the file. Everything works fine until i try to launch a jpg that resides at a network location (for instance "\\My...

Copying Files with Spaces

I'm trying to copy one file to another directory, but the way I am copying the file is not working when the source path has a directory with spaces in it, e.g. /Volumes/public/Music/Directory With Spaces/01.mp3 I am using: http://commons.apache.org/io/ I can't find a way around this, any ideas? Edit: The problem should probably be p...

open local files in AS3

Hi, How do i open file and get its content as a ByteArray in AS3. I saw examples, using FileStream & File classes from flex.filesystem, but the doc says it's for AIR only. Thanks, Nava ...

How to read from database and write into text file with C#?

How to read from database and write into text file? I want to write/copy (not sure what to call) the record inside my database into a text file. One row record in database is equal to one line in the text file. I'm having no problem in database. For creating text file, it mentions FileStream and StreamWriter. Which one should I use? ...

Not possible to launch a file on a network using Java Desktop?

I have a problem that i illustrated in this question but had no correct answers. I refined my problem and tried to edit the initial question to reflect that but i guess because of the way SO displays unanswered questions (if a question has an upvoted answer even if it does not solve your problem, the question no longer gets displayed in ...

Determine total number of bytes read by a process.

I am currently working on a project where one of our goals is to reduce the total amount of data read from disk. Is there a way to determine the total number of bytes run by a process? I am working with on a C++ application built with Visual Studio 2005, running on Windows XP. Ideally, I would like some sort of monitor that can print re...

Writing to default-constructed fstream: Undefined Behavior?

Consider the following: std::basic_fstream<char> testfile; testfile.write(reinterpret_cast<const char*>(&someInt), sizeof(int)); testfile.close(); This runs with no complaint when built with VC 8.0, but crashes when built with VC 10.0 beta. I have some legacy code that actually relies on the VC 8 behavior, where we inherit from basic...

Interleaved parallel file read slower than sequential read?

I have implemented a small IO class, which can read from multiple and same files on different disks (e.g two hard disks containing the same file). In sequential case, both disks read 60MB/s in average over the file, but when I do an interleaved (e.g. 4k disk 1, 4k disk 2 then combine), the effective read speed is reduced to 40MB/s instea...

File open: Is this bad Python style?

To read contents of a file: data = open(filename, "r").read() The open file immediately stops being referenced anywhere, so the file object will eventually close... and it shouldn't affect other programs using it, since the file is only open for reading, not writing. EDIT: This has actually bitten me in a project I wrote - it prompte...

delete files from the folder older than 4 days.

Hi, I would like to run a timer for every 5 hours and delete the files from the folder older than 4 days. Could you please with sample code? Thank you.. ...

Superfast way to read large files line-by-line in VBA. Please critique.

I believe I have come up with a very efficient way to read very, very large files line-by-line. Please tell me if you know of a better/faster way or see room for improvement. I am trying to get better at coding, so any sort of advice you have would be nice. Hopefully this is something that other people might find useful, too, so it isn...

Reading a file in vb.net

how to read a text file character by character in VB.NET?? ...

Is it possible to build a remote file manager in PHP?

Is it possible to do file operations from a script running on a different server than the files being operated on? That is, upload, move, rename, delete, create new, modify, etc. How would I go about doing this? ...

Why am I getting a different xml file open behaviour depending or where I open the sln file?

Ok, I know that question is not very informative.. Someome feel free to change it after I explain: My asp.net mvc project is stored in a folder in my desktop. When I double click on the sln or csproj to open the project and then hit the Start Debuggin button it all works fine. But, when I go to start, programs and open Visual Web devel...