ntfs

Store metadata outside of file: Any standard approach on modern Windows?

流过昼夜 提交于 2019-12-21 21:54:00
问题 My C# app syncs files from a remote document management system to a filesystem. The document management system has metadata (date of last audit, secrecy, author...) which is associated with each file but not stored WITHIN each file. The files can be anything (bmp, xwd, pdf, unknown binary) I want to make these metadata visible on the local Windows filesystem. But I can't store metadata WITHIN each file. For instance, changing the secrecy of a file must NOT modify the checksum of the file.

How do I read Windows NTFS's Alternate Data Stream using Java's IO?

怎甘沉沦 提交于 2019-12-21 20:57:21
问题 I'm trying to have my Java application read all the data in a given path. So files, directories, metadata etc. This also includes one weird thing NTFS has called Alternate Data Stream (ADS). Apparently it's like a second layer of data in a directory or file. You can open the command prompt and create a file in the ADS using ':', for example: C:\ADSTest> echo test>:ads.txt So, C:\ADSTest> notepad :ads.txt Should open a notepad that contains the string "test" in it. However, if you did: C:

Speed up NTFS file enumeration (using FSCTL_ENUM_USN_DATA and NTFS MFT / USN journal)

女生的网名这么多〃 提交于 2019-12-21 19:51:05
问题 I'm enumerating the files of a NTFS hard drive partition, by looking at the NTFS MFT / USN journal with: HANDLE hDrive = CreateFile(szVolumePath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, NULL, NULL); DWORD cb = 0; MFT_ENUM_DATA med = { 0 }; med.StartFileReferenceNumber = 0; med.LowUsn = 0; med.HighUsn = MAXLONGLONG; // no change in perf if I use med.HighUsn = ujd.NextUsn; where "USN_JOURNAL_DATA ujd" is loaded before unsigned char pData[sizeof(DWORDLONG) +

how to set folder ACLs from C#

流过昼夜 提交于 2019-12-21 05:41:19
问题 How can I automate the following manual steps in C#? Right click a folder in Windows Explorer; Properties -> Security -> Advanced -> Edit Un-tick "Include inheritable permissions from this object's parent" and click Remove. Click Add, choose a group and grant it Modify rights. I've found this article, which looks like exactly what i need, but I don't have and cant find Microsoft.Win32.Security . 回答1: check the code below: DirectoryInfo dInfo = new DirectoryInfo(strFullPath); DirectorySecurity

Master File Table cleanup utility? [closed]

社会主义新天地 提交于 2019-12-21 05:21:13
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . 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. 回答1: This paper by Hal Berghel and David Hoelzer lists a whole bunch of products which claim to securely erase files. MFT

Deleting a file based on disk ID

蹲街弑〆低调 提交于 2019-12-21 03:36:10
问题 As described here, using SetFileInformationByHandle with FILE_DISPOSITION_INFO allows one to set a file with an open handle to be deleted upon all handles being closed. However, I am trying to delete a file based on its file index (disk ID) retrieved by FILE_DISPOSITION_INFO and OpenFileById in order to safely delete files/directories in a directory which differ only in case. This is safe to do in my use case, as on an NTFS system, file indexes are persistent until deletion, negating the use

C# file creation - how to grant IUSR DELETE?

人走茶凉 提交于 2019-12-20 06:28:44
问题 I've got a console program written in C# which runs under user foo. The program creates a file. In some situations a web application running under the IUSR needs to be able to delete the files created by the console app. I'd like to grant DELETE (or anything equivalent) to IUSR when the file is created. How can I do that in C# ? I've found FileIOPermission and I'm not sure what that's for but as you can't specify a particular user I'm pretty sure that's now what I need. Anyone got a good

Getting notified when a file lock is released

北慕城南 提交于 2019-12-20 02:56:15
问题 [Using C# and Windows as platform] I have a camera that writes JPG files to a local folder in my PC. I want to load each file the camera drops, so I have a FileSystemWatcher that notifies me whenever a new picture is created, but the camera locks the file while it's being written , so if I try to load it just after being notified of its creation, I get an exception saying that the file is locked . Currently, I have a while loop (with a Thread.Sleep) that retries to load the image every 0.2

How to retrieve the target of a Junction or Symlink with a standard user

匆匆过客 提交于 2019-12-20 01:57:27
问题 I am trying to get the target of a junction in my program, but the only way I managed do it is: Requesting Backup privileges p-invoke CreateFile with special parameters to get a handle to the file/dir. DeviceIoControl call to the get the target. The 1st step will not work with normal user accounts, because they have no Backup privileges, and I don't want to get the UAC User Consent window every time I do this. I think this is doable somehow, because a normal "dir /A:L" command resolves the

NTFS directory has 100K entries. How much performance boost if spread over 100 subdirectories?

本小妞迷上赌 提交于 2019-12-19 19:37:26
问题 Context We have a homegrown filesystem-backed caching library. We currently have performance problems with one installation due to large number of entries (e.g. up to 100,000). The problem: we store all fs entries in one "cache directory". Very large directories perform poorly. We're looking at spreading those entries over subdirectories--as git does, e.g. 100 subdirectories with ~ 1,000 entries each. The question I understand that smaller directories sizes will help with filesystem access.