filesystems

When is it okay to check if a file exists?

File systems are volatile. This means that you can't trust the result of one operation to still be valid for the next one, even if it's the next line of code. You can't just say if (some file exists and I have permissions for it) open the file, and you can't say if (some file does not exist) create the file. There is always the possib...

How can I detect if the file for an open filehandle has been deleted on Windows using Perl?

Hello, I have a process with an open filehandle to a file. I need to detect if this file has been deleted by another process (there may be a file with the same name in its place). On UNIX I was comparing the inodes of my filehandle and the file-path via stat, but this doesn't work on Win32. How can I do this in Perl? Thanks, -Peter ...

Shared network folders usage by PHP scripts - is this possible from outside the domain?

I am having the following difficulties: Three servers A,B,C : A,B in the same network domain; C in another. PHP scripts executing on server A write to a shared folder on server B. The same scripts executing on server C fail to write to server B. PHP looks something like this: oject->Output('\\\\serverB\\sharedfolder\\file.dummy'); Is...

Is there a way to get the filename/location information from the MFT of an NTFS volume?

I need to get the list of all the files on a drive. I am using a recursive solution. But it is taking a lot of time. I was wondering that, is it possible to get the names and location of all the files on a NTFS drive from it's Master File Table? I think it will be very fast. Any suggestions? ...

Does Linux guarantee the contents of a file is flushed to disc after close() ?

When a file is closed using close() or fclose() (for example), does Linux guarantee that the file is written back to (persistent) disc? What I mean is, if close() returns 0 and then immediately afterwards the power fails, are previously written data guaranteed to persist, i.e. be durable? The fsync() system call does provide this guara...

Will blocks of a recently-created subsequently deleted file ever be written back to disc?

Suppose I have a process which creates a file, writes some data to it, then after a short amount of processing (by itself or another process), deletes it and closes all remaining file descriptors. I am assuming here that there is enough ram to keep the pages in memory until the file is deleted, and that nobody calls sync() in the interi...

Truncate file at front

A problem I was working on recently got me to wishing that I could lop off the front of a file. Kind of like a “truncate at front,” if you will. Truncating a file at the back end is a common operation–something we do without even thinking much about it. But lopping off the front of a file? Sounds ridiculous at first, but only because we’...

A question about cache of filesystem.

When I read a large file in the file system, can the cache improve the speed of the operation? I think there are two different answers: 1.Yes. Because cache can prefetch thus the performance gets improved. 2.No. Because the speed to read from cache is more faster than the speed to read from disk, at the end we can find that the cach...

Very slow open() (six seconds plus) on full UFS just starting to undergo a mass delete?

We have a UFS partition on solaris. The volume becomes full. We're still trying to write to it - and naturally open() returns -1 immediately. When a cronjob fires up which does a mass delete, it looks like open() doesn't return in a timely manner - it's taking at least six seconds, because that's how long before the watchdog kills the...

how to create loop in linux filesystem

how to create a loop in linux filesystem ? I want to break the directed acyclic graph(DAG) property of linux file system.. Is it possible?... I have seen this condition(loop in filesystem) once when I installed scratchbox cross compilier in my ubuntu linux distro... .. I dunno how to reproduce it now... ...

2GB limit on file size when using fwrite in C?

Hi, I have a short C program that writes into a file until there is no more space on disk: #include <stdio.h> int main(void) { char c[] = "abcdefghij"; size_t rez; FILE *f = fopen("filldisk.dat", "wb"); while (1) { rez = fwrite(c, 1, sizeof(c), f); if (!rez) break; } fclose(f); return 0; } When I run the progra...

Web Application Accessing Local Filesystem

Hello all, I have a web application (.NET, if it matters) where when one of the pages is loaded, a file on the users local machine needs to be copied (uploaded) to the webserver. This upload needs to be without user intervention. This web application will be running on a kiosk where I would be setting up the original permissions and t...

How to determine if a file will be logically moved or physically moved.

The facts: When a file is moved, there's two possibilities: The source and destination file are on the same partition and only the file system index is updated The source and destination are on two different file system and the file need to be moved byte per byte. (aka copy on move) The question: How can I determine if a file will ...

How to get creation date of a file in Java

I have a number of CSV files that I want to download from Yahoo finance each day. I want my application to read the file's creation date (on my computer, not the server). If the creation date is prior to today then the new file should be downloaded (as it will have new data). If not then the new file should not be downloaded, and the cor...

Will string.Trim() ever remove *valid* characters from a filename?

I'm creating a class to store a filename. To do so, I need to know exactly which characters are invalid and exactly which characters are invalid as leading/trailing characters. Windows Explorer trims leading and trailing white-space characters automatically when naming a file, so I need to trim the same characters when constructing a f...

How to "walk around" in the File System with Java

Hi. I'd like to do a search for folders/directories from java, and go into those folders/directories in java. I guess it's called system utilities? Any tutorials out there, or books on the subject? Thanks ;) ...

Which files do control the visibility of your website?

I run the following command at uni to my user account chmod -R 700 * Then, I run chmod -R 755 public_html My homepage remains to be "Forbidden" when I browse to it. The permissions of my user account 4 drwx------ 5 Newbie staff 4096 2008-12-19 12:39 Desktop 4 drwx------ 10 Newbie staff 4096 2009-04-16 02:28 Documents 4 drwx----...

How to understand asynchronous io in Windows?

1.How to understand asynchronous io in Windows?? 2.If I write/read something to the file using asynchronous io : WriteFile(); ReadFile(); WriteFile(); How many threads does the OS generate to accomplish these task? Do the 3 task run simultaneously and in multi-threading way or run one after another just with different order? 3.Ca...

Master File Table cleanup utility?

Can anyone recommend a tool for MFT cleanup? I want to in my MFT restore the entries for files which once existed but have been deleted to a "pristine" state, with zeroed out entries. ...

Are there any open source filesystems for Windows that support encryption?

I know that NTFS supports encryption but otherwise is closed source. Likewise, I am aware of add-ins such as truecrypt but I am interested in encryption being built-in vs being bolted on. ...