How can I make desktop.ini work on network locations?

4

2

I've got a simple desktop.ini file that applies a folder icon. It works just fine in a local folder.

I'd like it to work on a network location, as we have an external hard drive connected to our network. However, the desktop.ini file seems to have no effect on said network.

What am I doing wrong?

Eric

Posted 2010-06-07T09:15:26.687

Reputation: 385

Possible duplicate of Set custom folder icon for a network folder in Windows File Explorer

– matt wilkie – 2016-10-17T21:35:11.717

@mattwilkie: possibly, although this predates that by 3 years – Eric – 2016-10-17T22:12:28.080

1Acknowledged @eric, the other has better answers though. Either way as long as they're linked things are improved. – matt wilkie – 2016-10-17T22:21:54.417

Answers

4

Why this happens

Windows will not read the desktop.ini unless it's a system file (seemingly readonly also works, but system file means it can stay hidden even when you set non-system hidden files to visible).

Why you seemingly can't fix it

On a Samba share (Unix implementation of SMB/network share protocol), sometimes even if you e.g., go to properties and set "read only", it will be ignored and not set. This is because Samba isn't by default storing these permissions - which seems to carry a (probably negligible) performance tax, as permissions are (AFAIK) set and read in alternate streams as textual data (probably wouldn't work if you're sharing some rudimentary FS such as FAT).

How to fix it

First make sure Samba stores DOS-style permissions (like "system"), by adding this line on your share definition:

store dos attributes = yes

Maybe you can add this to [Global], I've added it to a specific share instead.

Also, some people will tell you to edit the wrong file.

  • /usr/share/samba/smb.conf <= nonsense
  • /etc/samba/smb.conf <= right file

Restart Samba (sudo service samba restart), then make a quick check to see if you can use Windows Explorer to make a file read only for example, and if it persists.

Ok, now, you can make the desktop.ini a system/hidden file. To do this, go to the folder where it is with command prompt, and use:

attrib +s +h desktop.ini

Optionally also (if your icon is relative and stored in the same folder as mine is).

attrib +s +h folder.ico

Lastly, you need to mark the folder itself as read-only (makes no sense and sounds stupid, so you know it's legit).

attrib +r .

Of cours, you can (should) script this. Using MSysGit's bash, I did this on my whole NAS:

find . -type f -iname desktop.ini | while read -r i; do
    echo "Processing \"$(basename "${i%/*}")\""
    attrib +s +h "$i"
    attrib +s +h "${i%/*}/folder.ico" # Optional, in case you have these.
    attrib +r "${i%/*}"
done

Camilo Martin

Posted 2010-06-07T09:15:26.687

Reputation: 2 308

3

Have a read at this article http://helpdeskgeek.com/how-to/customize-folder-icons-desktop-ini/

IconFile

If you want to specify a custom icon for the folder, set this entry to the icon’s file name. The .ico file extension is preferred, but it is also possible to specify .bmp files, or .exe and .dll files that contain icons. If you use a relative path, the icon is available to people who view the folder over the network. You must also set the Icon Index entry.

In over words you will have to specify a relative path to your icon

eg ./hiddenfolder/mycoolicon.ico

Note that you may need to place two (or more) dots if the directory of the .ico folder lies outside of the location of the desktop.ini file- try experimenting and refreshing the Windows/File Explorer window.

Good Luck

Christopher Wilson

Posted 2010-06-07T09:15:26.687

Reputation: 616

1No, that's not the problem. The desktop.ini file seems to be ignored, as none of the other commands in it are being processed either. Interestingly, I can't set it to be "hidden". – Eric – 2010-06-07T10:28:49.760

What OS are you using to view the shared folder? – Christopher Wilson – 2010-06-07T12:47:44.690

Windows XP. [15 char limit] – Eric – 2010-06-08T06:52:22.993

3

You have to mark the folder as system or readonly, to make the desktop.ini work. readonly is better, as system folders are omitted from explorer-searches by default. attrib +r (folder name)

melinski

Posted 2010-06-07T09:15:26.687

Reputation: 31

2

The problem has to do with the host containing the folder. Some network attached storage device (NAS), like the DROBO for example, run internally on Linux and their SAMBA network shell does not respect nor correctly implement the standard windows file attributes (R,S,H,A,I).

So relative paths will NOT help if the desktop.ini file is not read in the first place !!!

Because the host device, RAID, NAS or drive does not correctly report the "System" or "Read only" bit which windows expects to trigger the processing of the desktop.ini file, the file is never read and its contents do not matter.

Have found no solution to this problem yet.

xyz_nothere

Posted 2010-06-07T09:15:26.687

Reputation: 21

0

To report correctly the file type "System" or "Read only", you have to modify the "smb.conf" in your NAS. In the [Global] section, add the line :

store dos attributes = yes

Enjoy !

M2C

M2C

Posted 2010-06-07T09:15:26.687

Reputation: 11

Don't forget to restart Samba service with the cmd : sudo service samba restart – M2C – 2016-04-22T17:36:00.173

I wasn't the one who downvoted you, but in my case I had to set this in a share definition. I had set in global and it was ignored. – Camilo Martin – 2016-06-04T09:47:12.473