Unable to delete file on 2008 R2
I have a file server running WS2008R2 that contains files I'm unable to natively delete.
To start out with, I've tried a suggestion from Lee Holmes posted:
PS D:\root\export> Get-ChildItem -Force | %{[IO.File]::Delete($_.Fullname)}
Exception calling "Delete" with "1" argument(s): "Could not find a part of the path '\\.\con'."
At line:1 char:43
+ Get-ChildItem -Force | %{[IO.File]::Delete <<<< ($_.Fullname)}
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
Properties of the file are as follows. Interesting is that "Attributes" is set to -1 and the mode is darhs.
PS D:\root\export> Get-ChildItem -Force -Recurse | fl *
PSPath : Microsoft.PowerShell.Core\FileSystem::D:\root\export\con.pdf
PSParentPath : Microsoft.PowerShell.Core\FileSystem::D:\root\export
PSChildName : con.pdf
PSDrive : D
PSProvider : Microsoft.PowerShell.Core\FileSystem
PSIsContainer : False
VersionInfo :
BaseName : con
Mode : darhs
Name : con.pdf
Length :
DirectoryName : D:\root\export
Directory : D:\root\export
IsReadOnly : True
Exists : False
FullName : D:\root\export\con.pdf
Extension : .pdf
CreationTime : 12/31/1600 4:00:00 PM
CreationTimeUtc : 1/1/1601 12:00:00 AM
LastAccessTime : 12/31/1600 4:00:00 PM
LastAccessTimeUtc : 1/1/1601 12:00:00 AM
LastWriteTime : 12/31/1600 4:00:00 PM
LastWriteTimeUtc : 1/1/1601 12:00:00 AM
Attributes : -1
Regarding the date/time:
"If the file described in the FileSystemInfo object does not exist, this property will return 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC), adjusted to local time."
http://msdn.microsoft.com/en-us/library/system.io.filesysteminfo.lastwritetime.aspx
When trying to delete the file (using del) or modify file properties (i.e. remove ReadOnly, change ownership) I get "file cannot be found"
Running the sysinternals tool, junction.exe, to look for symlinks, junctions, etc returned zero results.
When I mount the folder from RHEL6, the file will open in vi just fine. Switching over to hex view shows the correct file headers for PDF files (0x25504446). All appears fine from the RHEL6 side of things. Also, running the command "file
con.pdf" correctly identifies the file as a PDF.
Listing the directory from RHEL6 shows:
552K -rwxrwx--- 1 550K Aug 29 2000 con.pdf
There was another file I was able to delete. It had the same properties as the above file. By creating a new file in the same directory with the same name, I was then able to delete both files.
Any suggestions?
May 31st, 2012 1:24pm