C++/Win32: How to wait for a pending delete to complete

There are other processes in Windows that want a piece of that file. The search indexer is an obvious candidate. Or a virus scanner. They’ll open the file for full sharing, including FILE_SHARE_DELETE, so that other processes aren’t heavily affected by them opening the file. That usually works out well, unless you create/write/delete at a … Read more

Case-sensitive path collisions on case-insensitive file system when I do git clone

Definitions case-sensitive filesystem: treats john.jpg and JOHN.jpg as two different files and this is allowed. case-insensitive filesystem: treats john.jpg and JOHN.jpg as one and the same file which is not allowed. Problem ‘components/User/index.js’ ‘components/user/index.js’ The problem here is that User and user are not allowed to co-exist at the same time inside the components directory … Read more

How do I force Robocopy to overwrite files?

From the documentation: /is Includes the same files. /it Includes “tweaked” files. “Same files” means files that are identical (name, size, times, attributes). “Tweaked files” means files that have the same name, size, and times, but different attributes. robocopy src dst sample.txt /is # copy if attributes are equal robocopy src dst sample.txt /it # … Read more

How to read and modify NTFS Alternate Data Streams using .NET [closed]

Here is a version for C# using System.Runtime.InteropServices; class Program { static void Main(string[] args) { var mainStream = NativeMethods.CreateFileW( “testfile”, NativeConstants.GENERIC_WRITE, NativeConstants.FILE_SHARE_WRITE, IntPtr.Zero, NativeConstants.OPEN_ALWAYS, 0, IntPtr.Zero); var stream = NativeMethods.CreateFileW( “testfile:stream”, NativeConstants.GENERIC_WRITE, NativeConstants.FILE_SHARE_WRITE, IntPtr.Zero, NativeConstants.OPEN_ALWAYS, 0, IntPtr.Zero); } } public partial class NativeMethods { /// Return Type: HANDLE->void* ///lpFileName: LPCWSTR->WCHAR* ///dwDesiredAccess: DWORD->unsigned int ///dwShareMode: … Read more

Enable native NTFS symbolic links for Cygwin

⸻⸻  Short answer  ⸻⸻ Define environment variable: CYGWIN=winsymlinks:nativestrict As pointed out by mwm you may also have to go to the settings or to run bash as Administrator. See the Notes section. ⸻⸻  Long answer  ⸻⸻ Default Cygwin symlinks are just regular files By default Cygwin creates text files as workaround for Windows symlink flaw. … Read more