Delete queue in NTFS? - windows

In my apps (VB6 and C# 2008) on Windows 2003 twice now I have seen similar behavior regarding deletion of folders containing files. My code will build some temporary folders and generates files in that folder for subsequent processing. Upon processing completion, my code will try to delete the generated temp folder. The delete operation completes without error.
However, upon further inspection, you can see that the folder still exists in windows explorer. Attempting to browse this folder results in a permission denied error. Later on the app will process another round of files and try to create the temp folder again. Unfortunately, the previous Pending Delete has not finished so trying to create the folder again results in permission denied error. The folder is not truly deleted until i close my app. As soon as the app is closed the folder gets deleted. Why are my folder delete operations not committed until the app is closed?

I wonder - is it possible you have accidentally retained a lock on that directory? that would explain why the directory cannot be removed until your app has departed.
There are some tools - try SysInternals - which will list file/directory locks. Try your app and then see if it retains a lock. I think you can then forcefully remove that lock - see then if the directory immediately disappears.

Related

File History first backup never succeeds. Nothing happens

I have an Windows box, which originally had Windows 7 installed and was later on upgraded to Windows 10.
On Windows 10 I added a 3TB hard disk for backups. I set up the new hard disc as backup target and started the first backup. This now is some days ago, but whenever I check the status I get following message: File History is saving copies of your files for the first time.
On the backup disc nothing happens. There is created a folder M:\FileHistory\username\boxname\Data, but there are no files in it.
There is just a link (for whatever reason not a button) below, to stop the backup. When I restart it, I get the same message but nothing happens.
Anybody any idea, what could be the reason or what to do?
Thanks in advance...
Finally found the solution. Keep in mind, I use a german version of windows. Hence, the menu point names may not be accurately translated.
In the control center > system and security > file history > extended settings
There is a link to the event viewer related to backup events.
It had some messages telling it could not save a file in a given folder. Deleting the folder, and also the BACKUP-DRIVE:\FileHistory folder on the backup drive solved the issues.

Are file level delete permissions enforced in Windows?

Someone recently raised a bug against a filter driver I've been working on. They said that I'd made it possible for a limited user to delete Windows files even if they remove the permissions on the file for the user to be able to do that.
I've been looking at it and it's nothing to do with my driver, even a fresh install of Windows allows this. If you:
Logon as a user called "limiteduser" who's a non admin.
Create a text file
Edit the security for the file
Remove inherited permissions and remove "limiteduser" from having any rights to the file.
Once you've done this you find that:
You can't changed the contents of the file.
You can't rename/move the file or send it to the recycle bin
However you can:
Delete the file in explorer with shift-delete
Delete the file with cmd.exe (del myfile.txt)
Why is this? Is deleting files always a property of the parent folder? And if so why isn't renaming files?
I know this answer isn't complete at all, but I hope it will be helpful nonetheless.
You didn't mention which version of Windows you are using, but as the ones that use any version of the NTFS file system should behave the same I believe it doesn't matter.
The documentation on "File and Folder Permissions" in Windows 2008 Server states that:
Groups or users that are granted Full Control on a folder can delete any files in that folder, regardless of the permissions protecting the file.
So it would appear that part of the answer to your question:
Why is this? Is deleting files always a property of the parent folder? And if so why isn't renaming files?
would be that deleting is indeed a property of the parent folder - it looks to me that it's the Delete Subfolders and Filesspecial permission that allows you to override the permissions on the file.
Why the "Full Control" permission on the folder won't give rename permission is unclear to me, but my guess is that it's actually only Delete Subfolders and Filesthat has the power to override; to rename a file you would have to have permissions to write too.
I'm guessing that the reason that "Shift-Del" in Explorer and "del" in cmd works and not "Recycle" would be that recycling is a move/change operation.
See this Technet article for reference: How Permissions Work

Writing to derived data in an archived app

I produced a .aiff file in my app and it's in my derived data folder, somewhere deep in the /Library. When I run the app in Xcode everything works fine. However when I archive it, the program crashes when it tries to write. How do I solve this? Do I need to learn to use Core Data or is there a easy fix?
Are you trying to write to the current working directory?
(If you're trying to do something like [foo writeToFile:#"output.aiff" …], you are.)
When you run within Xcode, the CWD is the build products directory within DerivedData where your application's bundle gets created.
When you run outside of Xcode, the CWD is the root of the startup disk, which you do not ordinarily have write access to and should never touch without explicit orders and permission to do from the user (via an Open panel or similar).
Either way, the CWD is the wrong place to put things.
You probably should run a Save panel, then write the file in your completion handler to the URL the Save panel has for you.
If you want to stash the file in some constant directory, ask an NSFileManager for the Caches folder in the user domain (~/Library/Caches), then tell it to create a folder inside that folder whose name is your main bundle's bundleIdentifier, then write the file in that directory.

.svn/lock file access denied

I have got a SVN Server. Which worker perfect untill this morning (Last commit 10:35:39). There was a file created at the hidden .svn folder which is named "lock" at that commit time.
After the file was created I cannot COMMIT, UPDATE, CLEAN-UP and tried to login as Server admin. When I right click the file and select properties, the Security tab shows I do not have access to see the information. It is not possible to set myself as file admin. I can not delete the file.
Other checkout directories which also use the same SVN server still work.
Anyone knows how to delete this file or fix this issue?
I had a similar access denied issue when trying to move a repo from another server. I was able to load the repo by making sure I was the Owner of the target files

the action can't be completed because the folder or a file in it is open in another program

When deleting a folder that contains a file that is in use, it is common to see the following Windows 7 message,
"The action can't be completed because the folder or a file in it is open in another program."
I commonly have 10-20 programs open, 30-40 folders open, etc. In short, I have many executables running and many windows explorers open.
Does anyone know a simple trick to determine which program is using the file?
Does anyone know a simple trick to determine which file is blocking the delete operation?
This information would be highly useful to display in the Windows 7 'folder in use' dialog, but it is missing.
Consequently I have to close many of my open applications and folders to complete the delete operation. This is annoying because I have to re-open them after deleting them.
Have you seen this other question or this one?
I use to run ProccessExplorer and Find for the blocked folder.
Closing the application Malwarebytes allowed me to delete what I needed to via Windows Explorer.

Resources