Tuesday 4 August 2009

Unix syntax in windows

Ok so not the greatest first blog but still something worth sharing I thought.
Unix syntax in Windows. I know not the most exciting topic but this completely caught me off guard recently and I spent hours trying to figure out the problem.
So here it is MAC user phones IT support desk folders created from one MAC are inaccessible on another. However Folders are created in a windows share, which is also accessed by 15 PC users or so. PC Users also can not access files.
Initial thought ntfs permissions problem, so pop on to server take a look select folder, right click properties....... No security tab.
Odd right so try the usual taking ownership ect no joy.
Then I notice there is a space after the folder name something a mac will let you do even on a windows share. But syntax that windows doesn't recognise, bit like those system files on a mac that have '.' at the end 'entouragesys.' end up in your windows profile and you can't delete them.
So I googled ignoring folder syntax and eventually found '\\?\' so if you put that in front of the folder name with the rmdir command it works, directory deleted.
rmdir "D:\sytem folder\irrelevant\genius " (notice the space at the end of the folder path) But wait theres more........

I wasn't satisfied with that so tried using '\\?\' with the rename and ren commands no joy. Then decide to browse through the help commands again.
Used the dir command, gave me a list of directories nothing unusual. But I noticed something the dos 8 character name it still exists. When you browse the directories the postcards and certificates directories still come up (16 character names) the syntax isn't recognise so they are not 'registered' if you like.
However force PC DOS to use 8 bit names and suddenly they become postca~1 and certif~1 . The magic command to do this dir /x. However you have to be in the directory to do this.
D:\sytem folder\irrelevant\genius>dir /x
Ok so we can see a list of 8 character folder names now what we still can't access them?
Well I'm glad you asked lets rename them, How? you say. Well read on.....
D:\sytem folder\irrelevant\genius>ren postca~1 postca~2
We rename them using the 8 charcater format.
Once renamed the folder then appears in the explorer window as an 8 character name 'postca~2' so best to rename again to something ledgable from explorer or from PC DOS if you like.
D:\sytem folder\irrelevant\genius>ren postca~1 postca~2
D:\sytem folder\irrelevant\genius>ren postca~2 Postcards
Possible problems only if the folder name is shorter then 8 characters. But then we can still copy content out and remove the directories using '\\?\'.
Could also use /a switch with the dir command to show hidden folders. ">dir /x /a" hope this helps.

No comments:

Post a Comment