Category Archives: files

Save bitmap files in WPF and C#

This example shows how to use WPF and C# to save bitmap files. The example Set the pixels in a WPF bitmap in C# shows how to create a WriteableBitmap in WPF. This example shows how to save the resulting … Continue reading

Posted in files, graphics, image processing | Tagged , , , , , , , , , , , , , , , | 2 Comments

Merge directories in C#

This example lets you merge directories. Once upon a time, if you used Windows Explorer to move a file from one directory to another and the destination directory already contained a file with that name, you had the option of … Continue reading

Posted in directories, files, system, tools | Tagged , , , , , , , , , , , , , , | Leave a comment

Use a FileSystemWatcher to build a spooler in C#

This example uses a FileSystemWatcher to implement a spooling program. SPOOL is an ancient computer acronym dating from the 1950s that stands for “Simultaneous Peripheral Operations On-Line.” It is a technique in which jobs are placed in a queue in … Continue reading

Posted in controls, files | Tagged , , , , , , , , , , , , | Leave a comment

Find duplicate files in C#, Part 4 of 4

The last three posts described an application that searches for duplicate files and removes them. The program seems to work fairly well, at least for small test directories. When I tried it on a directory containing around 8,000 files, however, … Continue reading

Posted in algorithms, cryptography, files, system, tools | Tagged , , , , , , , , , , , , , , , , , , | 1 Comment

Find duplicate files in C#, Part 3 of 4

The last two posts described an application that searches for duplicate files and removes them. This post explains how the program removes the files when you click the Delete Selected button. When you click the button, the following code executes. … Continue reading

Posted in algorithms, cryptography, files, system, tools | Tagged , , , , , , , , , , , , , , , , , , | Leave a comment

Find duplicate files in C#, Part 2 of 4

The previous post Find duplicate files in C#, Part 1 of 4 explained how the example uses a LINQ query to select files grouped by hash code. This post explains how the program displays the files’ contents and how the … Continue reading

Posted in algorithms, cryptography, files, system, tools | Tagged , , , , , , , , , , , , , , , , , , | 1 Comment

Find duplicate files in C#, Part 1 of 4

This example lets you find and remove duplicate files. It’s fairly complex, so I’m going to cover it’s more interesting pieces in several posts. I won’t cover some of the less interesting pieces at all. Enter a directory path or … Continue reading

Posted in algorithms, cryptography, files, system, tools | Tagged , , , , , , , , , , , , , , , , , , | 2 Comments

Write a CSV file from an array in C#

The example Read a CSV file into an array in C# shows how to load a CSV file into a two-dimensional array of strings. This example does the opposite: it saves a two-dimensional array of strings into a CSV (comma-separated … Continue reading

Posted in database, files, strings | Tagged , , , , , , , , , , , , , , | Leave a comment

Calculate hash codes for a file in C#

Hash codes are codes that concisely represent files or other chunks of data. The basic idea is to combine the data’s bytes in ways so that two different files are likely to have different hash codes. If you save a … Continue reading

Posted in algorithms, cryptography, files | Tagged , , , , , , , , , , , , | 1 Comment

Copy a directory hierarchy into the executable directory in C#

The example Copy files into the executable directory in C# explains how to make Visual Studio copy a file into the executable directory when it builds a project. That makes it easy for the executable to find the file when … Continue reading

Posted in files, miscellany, system | Tagged , , , , , , , , , , , , , , , | Leave a comment