Deleting files that give an error of “The filename or extension is too long”

del 0-Namespace-https???next-services.apps.microsoft.com?browse?6.2.9200-1?670?en-US?c?AU?Namespace?pc?00000000-0000-0000-0000-000000000000?00000000-0000-0000-0000-000000000000.dat
The filename or extension is too long.

Cleaning up after a Windows 8 restore and had problems deleting some files. According to KB320081 one possible way was to “Use an auto-generated 8.3 name to access the file”. After some searching I found what this means thanks to this post (it annoys me to no end that lot’s of posts just copy and pasted the details in the KB320081 page and don’t explain how to use the 8.3 name for deleting stuff). So the 8.3 name is the first 6 letters of the file name appended with a ~1 with any similar files will have an incremented number (~2, ~3, etc) as shown below.

1. My Chicagotech A.doc => MYchic~1.DOC
2. My Chicagotech B.doc => MYchic~2.DOC

I used this to help delete some files but even that didn’t manage to delete some files. In the end a “del name*” helped

C:\Windows.old\Users\Tim\AppData\Local\Packages\WinStore_cw5n1h2txyewy\AC\Microsoft\Windows Store\Cache>dir
 Volume in drive C is Windows8

 Directory of C:\Windows.old\Users\Tim\AppData\Local\Packages\WinStore_cw5n1h2txyewy\AC\Microsoft\Windows Store\Cache

13/Apr/2014 16:09 <DIR> .
13/Apr/2014 16:09 <DIR> ..
01/Nov/2013 21:35 5,578 0-Namespace-https???next-services.apps.microsoft.com?browse?6.2.9200-1?670?en-US?c?AU?Namespace?pc?00000000-0000-0000-0000-000000000000?00000000-0000-0000-0000-000000000000.dat
28/Oct/2013 13:04 5,578 0-Namespace-https???next-services.apps.microsoft.com?browse?6.2.9200-1?670?en-US?c?GB?Namespace?pc?00000000-0000-0000-0000-000000000000?00000000-0000-0000-0000-000000000000.dat
27/Oct/2013 18:42 5,574 0-Namespace-https???services.apps.microsoft.com?browse?6.2.9200-1?615?en-GB.en-US?c?GB?Namespace?pc?00000000-0000-0000-0000-000000000000?00000000-0000-0000-0000-000000000000.dat
01/Nov/2013 21:35 474 0-ProductTileExtendedByProductGuidForOS-https???next-services.apps.microsoft.com?browse?6.2.9200-1?670?en-US_en-US.en?c?AU?OsUpgrade?0a295e4d-5f14-4b44-9c2e-c98177f9e2f4?pt?x64.dat

del 0-Prod~1.dat   # worked

del 0-Name~1.dat   # didn't work
Could Not Find C:\Windows.old\Users\Tim\AppData\Local\Packages\WinStore_cw5n1h2txyewy\AC\Microsoft\Windows Store\Cache-Name~1.dat

del 0-Name*        # worked
Advertisements

OS X: Solving “The operation cannot be completed because you do not have sufficient privileges for some of the items” problem

I was trying to backup some of my files in OS X onto an external hard disk and ran into the following error dialog box: “The operation cannot be completed because you do not have sufficient privileges for some of the items”

So I thought it was a permission issue of a file/folder that I did not have permission to read. So I went to file information (File > Get Info) of the folder and under “Sharing & Permissions”, I made sure that I had read permissions and clicked “Apple to enclosed items” (I believe this applies the permission rules to all sub files and folders recursively).

I tried copying the folder over again and the error dialog persisted. Wasn’t too sure why it still happened so I tried cleaning out the dot files using the “dot_clean” command from Terminal and viola! Copying went on without a hitch.

So when you encounter the “The operation cannot be completed because you do not have sufficient privileges for some of the items” again

  1. check file/folder permissions (use get Info from Finder)
  2. use dot_clean (from Terminal)