Android 10: What are my options to save files on external storage into a directory called “/sdcard/my-app/”

In Android Q direct File access is disabled by default for the apps outside their private folders. Here few strategies you can use in your case: Use the manifest option requestLegacyExternalStorage to have the old behavior but it won’t work anymore with Android R, so it’s really a short term solution; Save your files using … Read more

File access error with FileSystemWatcher when multiple files are added to a directory

A typical problem of this approach is that the file is still being copied while the event is triggered. Obviously, you will get an exception because the file is locked during copying. An exception is especially likely on large files. As a workaround you could first copy the file and then rename it and listen … Read more

How to copy a file while it is being used by another process

An Example (note: I just combined two google results, you may have to fix minor errors ;)) The important part is the FileShare.ReadWrite when opening the FileStream. I use a similar code to open and read Excel documents while excel is still open and blocking the file. using (var inputFile = new FileStream( “oldFile.txt”, FileMode.Open, … Read more

How do I create a file AND any folders, if the folders don’t exist?

To summarize what has been commented in other answers: //path = @”C:\Temp\Bar\Foo\Test.txt”; Directory.CreateDirectory(Path.GetDirectoryName(path)); Directory.CreateDirectory will create the directories recursively and if the directory already exist it will return without an error. If there happened to be a file Foo at C:\Temp\Bar\Foo an exception will be thrown.

Local file access with JavaScript

Just an update of the HTML5 features is in http://www.html5rocks.com/en/tutorials/file/dndfiles/. This excellent article will explain in detail the local file access in JavaScript. Summary from the mentioned article: The specification provides several interfaces for accessing files from a ‘local’ filesystem: File – an individual file; provides readonly information such as name, file size, MIME type, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)