Click here to Skip to main content
15,886,058 members
Everything / File system

File system

file-system

Great Reads

by Marijan Nikic
A utility for automatization of moving files from partition A to partition B and vice versa
by Sergeant Kolja
This is an alternative for "Memory leak detection for WinCE".
by dviljoen
You might be interested in SlickRun http://www.bayden.com/It is a general purpose launcher for opening folders or web sites, starting apps, etc. The user creates "magic words" and associates them with folders, urls, launching apps, opening documents, etc.
by TomQuinn
A simple function used to determine if a file path refers to a network drive and if it does convert it to use the UNC path

Latest Articles

by ToughDev
How to integrate FatFs FAT filesystem module with CH375/CH376 USB controller
by Marijan Nikic
A utility for automatization of moving files from partition A to partition B and vice versa
by FrostedSyntax
How to create batch files that make navigating the filesystem in the command prompt a breeze.
by Paw Møller
Implementing a simple file system as a file.

All Articles

Sort by Score

File system 

23 Apr 2013 by Ian A Davidson
I am sorry that I only saw this question today. I have a several years' experience with FileSystemWatcher (and with the Win32 API functions when using C++ before C#).These are the main areas to look out for:1) As you said, make sure the code that handles notifications is as quick as...
30 Dec 2010 by Dave Kreskowiak
Im just guessing because you didn't supply the exception message, but it sounds like you're opening the file while the process that is writing to it still has it open.Modify your code so that it retrys the file operations. If it gets an exception, wait a second or two and go back and try it...
21 Sep 2011 by AspDotNetDev
The read-only attribute and similar attributes are part of the meta-data for the file. They are stored by the operating system and cannot be found in the file data.Text files don't typically actually have an end of file character (or sequence) stored in the data. You know where the end of...
12 May 2012 by charles henington
public bool checkForText(string filePath, string textBoxText){ using (System.IO.StreamReader reader = new System.IO.StreamReader(filePath)) { string[] linesToComapare = reader.ReadToEnd().Split('\n'); for (int i = 0; i
12 May 2012 by Maciej Los
You can use LiNQ[^]!Examples to find string in a text file:Text file processing...[^]read text file word by word using linq[^]If you would like to read delimited files:Using LINQ to read delimited text files[^]tutorial reading a text file using linq[^]And another...
12 May 2012 by VJ Reddy
The references given by losmac in Solution 2 are good.In case if you want to only check whether a word typed in the TextBox is present in the text file then I think the Regex option is simple to use as shown belowif (Regex.IsMatch(System.IO.File.ReadAllText(textFileName), ...
22 Dec 2019 by Marijan Nikic
A utility for automatization of moving files from partition A to partition B and vice versa
31 Jan 2012 by Espen Harlinn
Have a look at ReactOS[^] or FreeDOS[^].There is also an implementation of FAT32 included with linux.The above links are for open source OSes so you'll find what you need somewhere in the code - try asking at their respective mailing lists.Best regardsEspen Harlinn
9 Apr 2012 by nv3
Difficult to answer without knowing what level of access your users have. If a user has administrator right there is in my opinion no way of totally hiding a file from him. That would be counter-productive, because as an administrator I am expected to have access to all files on the...
23 May 2012 by Sergeant Kolja
This is an alternative for "Memory leak detection for WinCE".
5 Dec 2010 by OriginalGriff
Try using this instead:while (!string.IsNullOrEmpty(line = sr.ReadLine())) { string[] parts = line.Split(','); ...
18 Jan 2011 by fjdiewornncalwe
If your web application has permission to the folder where you want to write the file, then you simply have to save the file to that folder in your code behind. Go forth and code it. If you run into problems with that, feel free to update your question and we can help you with syntax issues if...
17 May 2011 by Pete O'Hanlon
It really depends on what you are planning to do with the files. The Office tags are stored in special properties in the file, and these are displayed out using a shell extension. This allows you to transfer the files between users because the properties are actually part of the files.If you...
19 Oct 2011 by OriginalGriff
We can't.The file operations you are talking about are not just file related - they are related to the inner structure of your application. If you app works around a tree of independent videos, then "Save File" will mean something totally different to what it would if the application was a...
17 Dec 2011 by DaveAuld
After doing various searches on the big G, the best option might be to email the manufacturer or the guys here; http://www.tomovision.com/download/download.htm[^] They apparently have a file viewer that can read the format.
31 Jan 2012 by JackDingler
To add to above, if your aim is to encrypt the data, then making your file system non-standard, will make it harder to use with other systems.File based encryption will lower costs for your product across the board, as compared to writing a new file system and drivers for every OS. Not only...
20 Apr 2012 by Sergey Alexandrovich Kryukov
Sorry that I don't give you the full answer, because this is way too big topic for this Quick Questions & Answers.I only want to bring to your attention that you already trying to make a wrong assumption about Unix file systems. More exactly, there are many Unix-compatible file systems, so...
3 Jan 2013 by Richard MacCutchan
C:\ became more carefully protected with Vista, and continues to be so. You can usually get round the problem by running the program with administrator privileges. However, it is recommended that you do not use this location to store your data, but use one of the Special Folders[^].
9 Apr 2013 by Sergey Alexandrovich Kryukov
This is not really a "solution", but something you should better be aware of; please see these CodeProject articles:FileSystemWatcher - Pure Chaos (Part 1 of 2)[^],FileSystemWatcher - Pure Chaos (Part 2 of 2)[^].—SA
22 Mar 2019 by RickZeeland
After this line: foreach (FileInfo fileD in destFiles) you should first compare the file names for equality, and only then do the copying: If (file.Name.equals(fileD.Name)) { // your code ... } If you want something more advanced you could try Gerry's solution which involves using LINQ.
23 Aug 2010 by #realJSOP
Vista doesn't allow you to make changes to any folder in the Program Files folder. You have to use one of the special folders for Vista and later.Google this and pick your poison from the returned results set:"C++ vista special folders"EDIT -------You can make your setup program...
2 Sep 2010 by empire08
Hi, I want to fetch the user's name who were accessing the files in a shared folder. I already used filesystemwatcher class to monitor the folder, But unable to get the user's name who were accessing the files. Through what methodology i can able to achieve my goal?Thanks in Advance.
27 Sep 2010 by Henry Minute
I do not think that you can get the OpenFileDialog to do that.What you can do is create your own dialog, mimic the appearance of OFD if you want, probably containing a ListBox or ListView that would display the contents of Master.dat.Then handle the doubleclick event to load the F*.dat...
15 Nov 2010 by Sauro Viti
Look at FILE_OBJECT Structure (Windows Driver Kit)[^]. About FO_SEQUENTIAL_ONLY they say: The file associated with the file object was opened for sequential I/O operations only. This means that the file has been open for reading or writing sequentially (i.e. without seeking).
5 Dec 2010 by Manfred Rudolf Bihy
Come on mhr!I already answered your similar if not almost identical question here:http://www.codeproject.com/Questions/132988/Text-file-to-SQL-import-cells-problem.aspxI thought you'd learn something from that.Well, the answer most probably might be this: The delimeter in your...
12 Jan 2011 by #realJSOP
I would bet that you're saving the file itself separately from the filename (that's the way I'd do it), and your problem is in the stored proc that returns the name of the file to the asp.net web site. If you're saving the filename separately from the extnsion, maybe the column that contains...
12 Jan 2011 by OriginalGriff
Without code, it is difficult to tell you what is wrong, but there are four areas to look at:1) Code to upload file.2) Code to store file in the database.3) Code to retrieve file from the database.4) Code to upload the file.To isolate which step is giving a problem, start by looking...
19 Jan 2011 by Nish Nishant
Do you really want to transfer a file to a different server? Because if you merely want to copy a file to a location within the webserver, from your server side code, all you probably need to do is a local copy.If you really want to use FTP, then take a look at the FtpWebRequest class. See...
15 Apr 2011 by Manfred Rudolf Bihy
The program is running with the credentials of the user who started it. So this user can only modify the permissions (ACL's) if he has the right to do so. Once he has denied himself read access it will be impossible for that user to give those rights back. If the system identity has full access...
11 May 2011 by Rick Shaub
You can still use File.SetAccessControl() in your new method in place of FileStream.SetAccessControl(). I'd be willing to bet it works, too. MSDN actually recommends this practice:"While the FileStream class and SetAccessControl can be used on an existing file, consider using the...
20 May 2011 by Sergey Alexandrovich Kryukov
Bad idea!No, there are no a standard tagging method. I think, this is because creators of the system would also think it would be a bad idea.If you explain your ultimate goals (not contaminated with your own architectural ideas you're preoccupied with) you might have a chance to get and...
22 May 2011 by Abhijit Annaldas
Hello friends...Please tell me how to hide partition on external hard disk?I have partitioned my external hard disk into 2 and I want to hide and unhide one partition as and when required. I want to store important and personal data in hidden partition. The hidden partition should not appear...
17 Nov 2011 by Mohibur Rashid
Permission in Windows NT system. But Remember for Admin its open
21 Nov 2011 by Emilio Garavaglia
The proper way to do this is don't make a single app solving everything including problems not related to the app itself.There are two distinct separate problem here: An app that wants to manage images (that shouldn't question about folder nature, since they belong to the operating system)...
17 Dec 2011 by Amir Mahfoozi
As I understood its format is DICOM so try to analyze this open source software :http://www.osirix-viewer.com/[^]Or you can convert it to a wellknown format :Converting a DICOM image to a common graphic format and vice versa with DCMTK and...
16 Jan 2012 by NandaKumer
check these blogsFile Upload with ASP.NET[^]http://www.4guysfromrolla.com/webtech/091201-1.shtml[^]--NDK
29 Jan 2012 by BillWoodruff
The first thought that comes to mind is using a USB flash-drive that can be password-protected. This company claims its password-protection software is free: [^], but I have never used it.This CP article may be helpful as a starting point: "Developing a USB Storage Device Protection Tool...
7 Feb 2012 by Jonathan [Darka]
A virus can infect any file which can be executed, the file extension is not important.Each executable file can be identified no matter what extension you give it, if your proposing a whole new executable format then that would be a whole lot of work....Additionally, changing the...
7 Feb 2012 by Manfred Rudolf Bihy
I'm afraid that is not going to happen. A file can be opened and analzed by a virus to discover it's true purpose. Most files contain some headers that betray to the virus what they really are. For example by renaming a dll or an exe file to a file with a txt extension it could still be found...
9 Feb 2012 by RDBurmon
This should workImports System.IOPublic Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim sourcepath As String = "E:\temp\test\1.txt" Dim DestPath As String = "E:\Data\" ...
12 Feb 2012 by RDBurmon
Try this using System;using System.IO;class Program{ static void Main() { // See if this file exists in the SAME DIRECTORY. if (File.Exists("TextFile1.txt")) { Console.WriteLine("The file exists."); } // See if this file exists in the C:\...
23 Feb 2012 by SandipG
Please read this[^] article. I hope it helps.
21 Mar 2012 by Sergey Alexandrovich Kryukov
I don't think the whole notion of such algorithm is applicable to the flash devices at all."Removable flash memory cards and USB flash drives have built-in controllers to perform wear leveling and error correction so use of a specific flash file system does not add any benefit.", according...
10 Apr 2012 by Tox1k
Here's an interesting solution in c# from Iteration at NullCoders.com.using System;using System.Windows.Forms;using System.IO; private void GhostFolder(string FolderPath) { try { //Creates a New DirInfo Instance ...
18 Apr 2012 by Jochen Arndt
This line contains multiple errors:CreateFile(port_name,GENERIC_READ|GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN,NULL);port_name is not initializeddwCreationDisposition must be OPEN_EXISTING for serial portsdwFlagsAndAttributes should be 0 for...
23 Apr 2012 by Lakamraju Raghuram
Appropiate question is : what are the files created when a C++ program is compiled.This depends on the build configuration, compiler options and various many factors. The other important file would be .pdb : http://support.microsoft.com/kb/121366[^]
1 May 2012 by SASS_Shooter
The first thing I would suggest, then, is to get the sniffer trace run. It could be something as simple as challenge/response timing out, in which case you work to get the timing increased so you get the response back in enough time.It may also show you if you are getting fragmented packets...
2 May 2012 by Alan N
You sayWhen I create the batch files, it is created successfully, but while executing it, it opens another instance of the .NET application.I'm not clear if you are running the batch file at all, as it would not start the .NET application unless it contained a command to do...
13 May 2012 by Peter_in_2780
Why not use separate files? You can keep related information together either by a file name convention (Head0001, Data0001, Evnt0001, Rema0001, etc) or grouping them by directory structure.Peter
3 Jun 2012 by vivek.bagdai
For File browser you need two thing1. Directory path (Directory which user selects)2. List of all file.for 1. Requirement you can use FileBrowser,and for 2.you have to add list box and load all file list in the below code will help//Here "c:\user\public\picture" is Directory...
8 Jun 2012 by E.F. Nijboer
You'll need microsoft transaction server (mts) for this. With it, you create a transaction context, execute multiple actions (like file handling and database updates, also mixed) that all need to call SetComplete (indicating the code didn't encounter any problems). When you then call Commit, MTS...
5 Jul 2012 by Sergey Alexandrovich Kryukov
This code makes no sense even in XP, it's working only by luck. I don't want to analyze it all. Look at "D:\\contents.txt". This file location is illegal in Windows 7 and makes no sense event in XP. Of course, you can do some administration work on each system and make "D:" accessible, but it...
8 Jul 2012 by OriginalGriff
".BIN" files are not notepad friendly - they are binary files rather than text based. You need to use a program which is Binary friendly instead.If you download PSPAD[^] It will happily edit text and binary files using the appropriate editor for each. It's freeware, and I've been using it for...
19 Aug 2012 by Christian Graus
You can't. It's in a stream, you can't do anything with it, apart from write it somewhere, or store it for your use. Windows can't open a program that is not on the hard drive, when it's in that pure binary form. You're just writing code at random, trying to do something impossible.
19 Aug 2012 by Dave Kreskowiak
You can not create a new process from a stream. It can only be launched from a file on disk.
21 Oct 2012 by User 6344851
I decided to go the clean but hard way.First I read Rajeev Nagar's book "Windows NT File System Internals : A Developer's Guide" (and a few other books related to windows debuging and driver developement), then I had a closer look at the "dokan" project and TryeCrypt, which are both open...
26 Oct 2017 by Sairam Kannan
Hello All,Following is my scenario:I will get xml file in my source folder and i have to pick them up and process create new xml file and place it in destination folder. I have a window service in my application in which i have included file system watcher concept for performing above...
29 May 2013 by Prasad Khandekar
Hello,What you want is done by changing the appropriate options in configuration file (filemanager.config.js). Here is how you can specify a different folder located under serverRoot."serverRoot": true,"fileRoot": "myapp/documents/",If you want to use a folder not located under the...
1 Jul 2013 by Santhosh G_
Here are some Win32 methods. I'm not sure about aware about similar methods in C#.Here is an example to start an application from memory, by reading exe file contents from memory.http://www.rohitab.com/discuss/topic/31681-c-run-program-from-memory-and-not-file/Encrypted script in an...
1 Jul 2013 by lewax00
You really can't achieve what you want here. If the information is on their disk, it's as easy as booting into Linux via a Live CD and you can ignore all Windows file permissions. If you encrypt it, you have to keep the decryption key some where in your program, and it can be decrypted if...
22 Aug 2013 by Richard MacCutchan
See https://www.google.com/search?q=java+raw+disk+io[^].
10 Sep 2013 by Joezer BH
Use DirectoryInfo's GetDirectories to get a list of directoriesHere's a simple example:// Make a reference to a directory.DirectoryInfo di = new DirectoryInfo(@"c:\");// Get a reference to each directory in that directory.DirectoryInfo[] diArr = di.GetDirectories();// Display...
31 Dec 2013 by OriginalGriff
Probably, when you saved it yoU overrode thE extension and didn't give it any - so it is saved asFilenamerather than Filename.extFilename.bakFilename.sqlOr similar.Look at the file in Windows Explorer and open the "Organise" drop down.Select "Folder and Search Options" and then the...
6 Jan 2014 by BK 4 code
Hi Please use this one to give programatically permission to access of file.FileIOPermission f2 = new FileIOPermission(FileIOPermissionAccess.Read, "C:\\test_r");f2.AddPathList(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, "C:\\example\\out.txt");Here you can set path...
17 Mar 2016 by Jens Madsen, Højby
Can't you use DirectoryInfo object?Like this:{ Comparison dirComp = (x, y) => { int i = y.LastAccessTime.CompareTo(x.LastAccessTime); if (i == 0) { i = string.Compare(x.Name, y.Name, StringComparison.InvariantCultureIgnoreCase); } return...
16 Mar 2019 by OriginalGriff
Have a look at this: ByteArrayBuilder - a StringBuilder for Bytes[^] the code is in C#, but Code Converter C# to VB and VB to C# – Telerik[^] should help if you can't work it out. Actually reading and writing a file full of bytes is simple: File.ReadAllBytes(String) Method (System.IO) |...
17 Mar 2019 by Dave Kreskowiak
If you must try to do a "line for line" conversion of the code (I DONT'T recommend it!), you're looking for the BinaryReader[^] and BinaryWriter[^] classes. It lets you do all kinds of reads and writes for various types (byte, int16, int32, int64, signed byte, single, ...) They don't provide...
22 Mar 2019 by Gerry Schmitz
You're only comparing dates, not file names. (Get rid of that "inner loop"). Do a .SingleOrDefault() call on destFiles.ToList() to check for a destination file given a source file name. If it doesn't find it, it's new; else compare the dates.
21 Jun 2022 by Richard MacCutchan
Variable xxx only exists inside the callback function. See JavaScript Scope[^]
21 Jun 2022 by Richard Deeming
fs.readFile is an asynchronous operation. That means it returns before the file has been read. The file data won't be available until the operation has completed and the callback function has been called. If you're using a recent version of...
23 Aug 2010 by Archman420
hi i am using visual studio 2008 and developing an application in C++/CLI. My application does some file IO. the directory structure is as follows"C:\Program Files\AppName\Data\settings.dat"im working on my laptop with windows vista. the programm does not allow me to create or read the...
26 Aug 2010 by cruise95
I'm programatically looking into an .aspx file and getting the file class name declared in its CodeBehind. For example, when analyzing myFile.aspx, I read in its Page Directive and found its CodeBehind equals "myApplication\myPage.aspx.vb". Then I use the code below: Dim Assm As...
26 Aug 2010 by #realJSOP
Try this (no guarantees, but it might give you a place to start):String strPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetAssembly(ClassType.BaseType));
26 Aug 2010 by cruise95
Thanx John,Unfortunately, GetDirectoryName() expects a string...but GetAssembly() returns a type.
15 Nov 2010 by Dr. Kelwin
Hi, guys!I have small FS filter which compress files on IRP_MJ_WRITE and decompress on IRP_MG_READ. If file operation goes to FS cache (FO_CACHE_SUPPORTED) I pass through this IRP, because it's no reason to compress/decompress files in cache. But in some situations I see file operations with...
5 Dec 2010 by mhrglbdn
void TextDateYukle(){ using (StreamReader sr = new StreamReader(File.Open("C:\\Tr500.txt", FileMode.Open))) { using (SqlConnection txtbaglan = new SqlConnection("server=.;database=.......;trusted_connection=true")) { txtbaglan.Open(); string line = ""; ...
6 Dec 2010 by dviljoen
You might be interested in SlickRun http://www.bayden.com/It is a general purpose launcher for opening folders or web sites, starting apps, etc. The user creates "magic words" and associates them with folders, urls, launching apps, opening documents, etc.
7 Dec 2010 by mhrglbdn
Excellent site users and members have an excellent, thank you..I solved the problem, but I find the current erich ...Thank you ManfredRBihy!!!
21 Dec 2010 by cjrowell74
Ok so this whole Java thing is a still new to me and I am trying to learn it by building myself something to list all the folders and subfolders i have in my music collection (this is a lot)I have the following code done so far and it loops through and lists the top level repeatly about 10...
30 Dec 2010 by Jibrohni
Hi all,I've got myself a little problem whilst implementing the FileSystemWatcher Class. I have a text file that it is "watching" for me. When the file changes I have my app spit out the new line to my form. This works, but I tend to get an IOException when I run it without breakpoints in. I...
30 Dec 2010 by Jibrohni
The file is getting updated very frequently so I had to implement a timer that checked it with a tick frequency of 1. I copy the original file and just deal with the copied file so I don't interrupt the original. - Jibrohni 1 sec ago
18 Jan 2011 by Mandavali
I am trying to create the screen from which I can upload file.Here is the thing. I don't want to save on same location as website. But Want to save on different website folder.Is is possible to do thatGetfile from Website1 using upload control and store it on website2 folderThank you
19 Jan 2011 by Mandavali
How do I ftp file using asp.net code
19 Jan 2011 by fjdiewornncalwe
From this question and your previous question, I think what you need to do is become familiar with the HTML input (type=file) control. File Upload with ASP.NET
11 Jul 2017 by hjaiuyg
Hello,For a project I'm assisting with I need to open the $MFT (the actual file) and calculate its MD5.Windows does acknowledge its existence (i.e. Create file to \\.\c:\$mft works) but any attempt to read from it returns Access denied error.tried a different approach with...
7 Feb 2011 by Andrew Brock
You will need to open the HDD (or better yet, just the partition) with direct access, then write your own file system library. You were pretty much doing this. Just use "\\\\.\\C:"The good news is that this is not as hard as it sounds.I would STRONGLY reccommend getting a hex editor. I...
17 Feb 2011 by TomQuinn
A simple function used to determine if a file path refers to a network drive and if it does convert it to use the UNC path
20 Feb 2011 by Prerak Patel
Here is an API way using WNetGetUniversalNameImports System.Runtime.InteropServices _ Private Shared Function GetUName(ByVal Path As String, ByVal outName As Integer, ByVal bObj As...
23 Feb 2011 by mhrglbdn
Hii..This project working, this one problem...Datagridview to excel export cells, but ı'am questions format, according to data in color, pattern, the table would appear to be doing...I want to make pictures of anyone who wants to tell how many ways...have a nice day...thank...
17 Mar 2011 by sairam.bhat
see thsi link it may help to uhttp://itsrashid.wordpress.com/2007/05/14/export-dataset-to-excel-in-c/[^]
15 Apr 2011 by lydiae
Hi,I am aiming at denying the Read permission for a certain folder at the start of my application and later giving the permission back for a particular user.Denying the Read permission works fine.DirectoryInfo myDirectoryInfo = new DirectoryInfo(folderName);DirectorySecurity...
15 Apr 2011 by Ashishmau
see this linkhttp://www.dotnetspider.com/forum/114190-folder-permissions-using-c-plz-help-me.aspx[^]
11 May 2011 by JohnLBevan
That's great - thanks Rick!I've now updated my code as per your recommendation (included below), and it works perfectly. I'd not tried this as I thought the lock was owned by the file stream, so accessing the file from a different object would cause issues - nice to learn otherwise...
22 May 2011 by Sergey Alexandrovich Kryukov
This is solvable.There is a HIDDEN flag for the partition which you can modify with most 3rd-party partition managers. Good partition managers are typically written for Linux (loadable from external disk) but can work with most file systems. You can Google to find an appropriate...
8 Jun 2011 by Jayxin
Hi All,I am trying to load a VCE file into a rich text box on a Window Form.Please help me.Thanks in Advance.
8 Jun 2011 by Ramalinga Koushik
Hope this[^] might help you.
8 Jun 2011 by Dave Kreskowiak
First, what's a VCE file??Second, the RichTextBox cannot understand all file formats. It knows plain text and RTF and that's about it. If a VCE files doesn't conform to RTF standards, it's not going to work.The only way around that is to convert the file to a format the RTB does know...
21 Jul 2011 by Manish Kumar Namdev
Hello Friends...I am using ASP.net C# to read the excel file and get it first column data in ArrarList.I wrote a code but couldn't achieve it.I used Excel name space and took a reference of Introp.Excel.dllPlease help me.RegardsManish Kumar Namdev
21 Jul 2011 by Mohammad A Rahman
Please see below,Reading excel column value to a string array[^]hope it helps :)
21 Jul 2011 by Abhinav S
You have not posted any code, so its not that easy to help you out.Try and have a look at Faster MS Excel Reading using Office Interop Assemblies[^], it could help you figure out your mistake.