Create Hidden Windows file/folder from Linux [closed]
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
开发者_运维问答 Improve this questionIs it possible to create a file on a mounted SMB share that is hidden from Windows? The .(dot) prefix doesn't work in this case because that only works on Linux. Basically I'm looking for the same affect as using attrib +h
on Windows, but under Linux.
Try setting the executable-by-others bit in the file you want hidden. For example:
- rwxrwxrw- <-- The file will not be hidden
- rwxrwxrwx <-- HIDDEN
Hopefully that helps. If you want the Windows hidden attribute to apply to your Linux share, by the way, you'll have to set map hidden = yes in your samb.conf file.
Assuming your Samba share currently looks like this in smb.conf
:
[share-with-hidden-files]
comment = this share shows all files when browsing it (doesn't work as expected)
path = /some/where/on/the/linux/file/system
browseable = yes
[...more settings...]
Add one more line to it:
[share-with-hidden-files]
comment = this share includes some hidden files
path = /some/where/on/the/linux/file/system
browseable = yes
[...more settings...]
hide files = /firstfile.doc/secondfile.pdf/.*/*.xls/
The hide files
instruction will turn all denoted files into invisible ones (but they are still accessible!). The DOS 'hidden' attribute is applied to any files or directories which match.
In above example line 2 files are explicitely named (a .doc and a .pdf) to be hidden, as well as all 'dot'-files and all .xls files.
Notes on using hide files
:
- file names are separated by '/'
- file names may contain spaces (but no '/')
- file names are case sensitive
- you may use '?' and '*' wildcards for filenames -
you can just use setmode filename +h
精彩评论