filesystems

Cross platform hidden file detection

What is the best way to do cross-platform handling of hidden files? (preferably in Python, but other solutions still appreciated) Simply checking for a leading '.' works for *nix/Mac, and file attributes work on Windows. However, this seems a little simplistic, and also doesn't account for alternative methods of hiding things (.hidden f...

Inserting text into an existing file via Java

Hello, I would like to create a simple program (in Java) which edits text files - particularly one which performs inserting arbitrary pieces of text at random positions in a text file. This feature is part of a larger program I am currently writing. Reading the description about java.util.RandomAccessFile, it appears that any write ope...

Optimisation: use local files or databases for HTML

This follows on from this question where I was getting a few answers assuming I was using files for storing my HTML templates. Before recently I've always saved 'compiled' templates as html files in a directory (above the root). My templates usually have two types of variable - 'static' variables which are not replaced on every usage bu...

How can I tell if a file is on a remote filesystem with Perl?

Is there a quick-and-dirty way to tell programmatically, in shell script or in Perl, whether a path is located on a remote filesystem (nfs or the like) or a local one? Or is the only way to do this to parse /etc/fstab and check the filesystem type? ...

How to uninstall a windows service and delete its files without rebooting

My current project involves deploying an upgraded .exe file that runs as a Windows Service. In order to overwrite the existing .exe with the new version, I currently need to: (1) stop the service (2) uninstall the service (3) reboot the system (so Windows releases it's hold on the file) (4) deploy the new .exe (5) reinstall the ser...

How to find the disk that holds a given partition in C#?

Does anyone know a way to find out programatically which physical disk holds a given partition? Manually, I can find this info using Start->Run->diskmgmt.msc , where I can see that (on my computer) that partitions C: and D: are on disk 1, E: & F: on disk 0. This is for optimizing some file crunching operations by doing them in parallel ...

Lightweight open-source shared file system over network

We have two web servers with load balancing. We need to share some files between those servers. These would be uploaded files, session files, various files that php applications create. We don't want to use a heavyweight, no longer maintained or a commercial solution. We're looking for some lightweight open-source software that would wo...

Quick file access in a directory with 500,000 files

I have a directory with 500,000 files in it. I would like to access them as quickly as possible. The algorithm requires me to repeatedly open and close them (can't have 500,000 file open simultaneously). How can I do that efficiently. I had originally thought that I could cache the inodes and open the files that way, but *nix doesn't...

reading FAT12 image file in C

I have a FAT12 image file and I have to open it and read it. I would like to view this image file(directories/files with in) so I can have an idea of what outcomes I should be getting. Anyone know of a good software that would let me view this FAT12 image file? Also can someone guide towards the right directions when trying to read the c...

performance of web app with high number of inserts

What is the best IO strategy for a high traffic web app that logs user behaviour on a website and where ALL of the traffic will result in an IO write? Would it be to write to a file and overnight do batch inserts to the database? Or to simply do an INSERT (or INSERT DELAYED) per request? I understand that to consider this problem properl...

How to fopen() on the iPhone?

The iPhone SDK docs claim fopen() is a supported method of file access but I am unable to get it to return a FILE handle. I am accessing a directory which is included in my project. I have tried fopen "filename","dir/filename","./filename","./dir/filename","/dir/filename" all returning with a null pointer. Some people report using it ...

How do I run robocopy without copying extended attribute information?

Greetings, I've got a bat script which copies certain information from a computer onto a USB hard drive using Robocopy. The hard drive is FAT formatted and therefore doesn't support directories with extended attributes, leading me to robocopy error 282 as described here. How do I tell robocopy to copy all the attribute information EXC...

Why do directory listings contain the current (.) and parent (..) directory?

Whenever I list the contents of a directory with a function like readdir, the returned file names also include "." and "..". I have the suspicion that these are just normal links in the file system and therefore indistinguishable from actual files, but I always have to filter them out because they are not actual objects in the directory ...

How does Windows determine/handle the DOS short name of any given file?

I have a folder with these files: alongfilename1.txt <--- created first alongfilename3.txt <--- created second When I run DIR /x in command prompt, I see these short names assigned: ALONGF~1.TXT alongfilename1.txt ALONGF~2.TXT alongfilename3.txt Now, if I add another file: alongfilename1.txt alongfilename2.txt <--- created third ...

Linux filesystem benchmarking best practices

(Not really a programming question, sorry) I'm working on benchmarking various filesystems (most importantly: ext3) with various filesystem options (for instance: noatime, relatime etc.) for specific situations on a Linux box. For raw filesystem benchmarks, I'm looking into bonnie and bonnie++. What is the most useful way to use bonn...

Best practices for storing uploaded files in filesystem

What is the best practices regarding storing files uploaded from users? Currently, I am during the following method for storing files: <web_app_root>/course_material/<term_id>/<course_id>/<file_id> As you can see, the files are stored according to the keys in the database. I thought this was safer, since I wouldn't have to filter fil...

Reading a sector on the boot disk

This is a continuation of my question about reading the superblock. Let's say I want to target the HFS+ file system in Mac OS X. How could I read sector 2 of the boot disk? As far as I know Unix only provides system calls to read from files, which are never stored at that location. Does this require either 1) the program to run kernel ...

Detect a file in transit?

I'm writing an application that monitors a directory for new input files by polling the directory every few seconds. New files may often be several megabytes, and so take some time to fully arrive in the input directory (eg: on copy from a remote share). Is there a simple way to detect whether a file is currently in the process of being...

Reading a large file into a Dictionary

Hi, I have a 1GB file containing pairs of string and long. What's the best way of reading it into a Dictionary, and how much memory would you say it requires? File has 62 million rows. I've managed to read it using 5.5GB of ram. Say 22 bytes overhead per Dictionary entry, that's 1.5GB. long is 8 bytes, that's 500MB. Average string len...

Get a file system handle to a bluetooth mapped folder

Is there any way to get code level access to a bluetooth mapped drive? The simple use case is I have a bluetooth folder in Explorer that looks something like: "My Bluetooth Places\Entire Bluetooth Neighborhood\DEV1\OBEX File Transfer\E:\" which maps to a device root, and I want to be able to read/write to the file system by treating ...