Is it possible to copy directory contents using the Java I/O and File-related APIs while preserving existing symlinks? I am working on a tool that needs to perform "directory copy" operations on a variety of UNIX flavours while preserving existing symlinks.
I'd prefer to attempt this using the core Java SE libraries without resorting Ru...
how can I use wild cars like '*' when getting a list of files inside a directory in Python? for example, I want something like:
os.listdir('foo/*bar*/*.txt')
which would return a list of all the files ending in .txt in directories that have bar in their name inside of the foo parent directory.
how can I do this?
thanks.
...
I would like to save a file downloaded from the internet in iPhone.
Can I use the url as the file name? If not, what transformation should I apply to the url to obtain a valid file name?
I need to find the local copy of the file later using its url.
Edit: Not asking where or how to write a file to disk. The question is limited to get...
I'm writing a todo list program. It keeps a file with a thing to do per line, and lets the user add or delete items. The problem is that for some reason, I end up with a lot of zero bytes at the start of the file, even though the item is correctly deleted. I'll show you a couple of screenshots to make sure I'm making myself clear.
This ...
The c++ program below fails to read the file. I know using cstdio is not good practice but that what I am used to and it should work anyway.
$ ls -l l.uyvy
-rw-r--r-- 1 atilla atilla 614400 2010-04-24 18:11 l.uyvy
$ ./a.out l.uyvy
Read 0 bytes out of 614400, possibly wrong file
code:
#include<cstdio>
int main(int argc, char* argv[...
Hi,
I'm looking for a minimal way to convert mp4 file to mp3 file programmatically from Java. Ideally I also need an cutting of target file.
Do Java libs support this or only 3th party ones? Like jmf, ffmpeg?
Thanks!
...
If I'm writing a simple text log file from multiple processes, can they overwrite/corrupt each other's entries?
(Basically, this question http://stackoverflow.com/questions/1154446/is-file-append-atomic-in-unix but for Windows/NTFS.)
...
I'm implementing an FTP-like protocol in Linux kernel 2.4 (homework), and I was under the impression that if a file is open for writing any subsequent attempt to open it by another thread should fail, until I actually tried it and discovered it goes through.
How do I prevent this from happening?
PS: I'm using open() to open the file....
I've been using std::istream and ostream as a polymorphic interface for random-access binary I/O in C++, but it seems suboptimal in numerous ways:
64-bit seeks are non-portable and error-prone due to streampos/streamoff limitations; currently using boost/iostreams/positioning.hpp as a workaround, but it requires vigilance
Missing opera...
Is there any advantage in using file writing with overlapped IO in Windows, vs just doing the file writing in a separate thread that I create?
[Edit - please note that I'm doing the file writes without system caching, ie I use the FILE_FLAG_NO_BUFFERING flag in CreateFile)
...
I'm trying to write an IXmlSerializable class that stays synced with an XML file. The XML file has the following format:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<logging>
<logLevel>Error</logLevel>
</logging>
...potentially other sections...
</configuration>
I have a DllConfig class for the whole XML file an...
I want to write a python code that open a text file and Replace with a word that i want send to it .
May you give me an example ?
Thanks .
...
In my application, if the user saves a file to a folder they don't have permissions for, File.Copy will fail. An example is saving a document to the C:\ root.
Instead of denying access, I'd like to prompt the user to elevate permissions with a UAC prompt, but only for this save function (not for the entire application). Is there a way t...
I have an uploader in my web page, but some people upload files named like "compañia 15% *09.jpg" and i have problems when the filenames are like that one.
I would like to found a class that returns for that example something like this: "compania1509.jpg".
...
The situation I'm in is this - there's a process that's writing to a file, sometimes the file is rather large say 400 - 500MB. I need to know when it's done writing. How can I determine this? If I look in the directory I'll see it there but it might not be done being written. Plus this needs to be done remotely - as in on the same int...
Hi All,
I am performing file operations (writeToFile) which fetches the data from a xml and writes into a output file(a1.txt).
I am using MS Visual C++ 2008 and in windows XP.
currently i am using this method of writing to output file..
01.ofstreamhdr OutputFile;
02./* few other stmts */
03.hdrOutputFile.open(fileName, std::ios::o...
Hi,
In C++, how can I count lines using the standard classes fstream, ifstream?
Thank you,
Mohammad
...
Hi,
I've passed a file to a library, and the library is spitting out a FileNotFound error as shown:
javax.xml.transform.TransformerException: java.io.FileNotFoundException: file:\C:\Users\Oroma\workspace\IndividualProject_JINQS\WebContent\WEB-INF\classes\presentationlayer\utility\mappings\jmt\networkModel.xml (The filename, directory ...
Hi,
I need to create and export an excel file in my iPhone app. Unfortunately, excel won't read it if the line encoding is LF (the unix default when I write the file) instead of CRLF (the Windows standard)...Is there any way to write a file using CRLF line breaks?
I can tell this is the issue as if I open the file in TextWrangler a...
Hey everyone,
In C, is there a way to read a text file line by line without knowing how much space to allocate for it?
here's an example of what I mean:
fgets(line, <dynamic line size>, fileHandle);
Thanks for the help!
...