Setting preventBackup property to true/false immediately sets the file attributes of the file if the file exists on the disk. In case it is created later using the same variable, it is automatically set. In your case var cacheDir:File = File.applicationStorageDirectory.resolvePath("cache"); cacheDir.preventBackup = true; // this will set the attribute it cache directory existed in File.applicationStorageDirectory otherwise if cacheDir ir is written to disk later , it is still set. However if use any third object to create cache directory inside the File.applicationStorageDirectory later, preventBackup would be false by default. I hope this clears your query.
... View more