There is an app called XtraFinder which does exactly that - it shows hidden files while it can still hide those two files from Desktop only.
Is it possible to do something like that without installing a 3rd party app (I'm using Mavericks)?
This first command will remove all the icons on your Desktop, but keep the files visible in finder:
defaults write com.apple.finder CreateDesktop -bool false && killall Finder
While this second one will restore all the icons on your Desktop:
defaults write com.apple.finder CreateDesktop -bool true && killall Finder
I came up with a brilliant way of doing this today.
Where do you usually have your Dock bar? Move it to the opposite side temporarily. Grab both the files and position them as far as possible off the screen on the side that you previously had your Dock. Now, switch the Dock back to the previous side. HIDDEN!
Run this command:
chflags hidden ~/Desktop/.DS_Store && chflags hidden ~/Desktop/.localized
Just like any other hidden file on your Mac, .DS_Store and .localized are going to be one of those files that appear when you turn hidden files 'on'.
Without 3rd party applications you are not able to hide them without hiding every other hidden application.
One thing you can do is, if there is only 1 or 2 hidden files/folders for eg. make aliases which in Windows standards are shortcuts. So Right Click the file > Make Alias.
Then when all files are hidden, the alias/s will still be visible rendering the file/folder openable.
Another thing you can do is actually delete .DS_Store and .localized which according to Wikipedia (I know, not the most reliable source but multiple other websites also said it)
.DS_Store is a proprietary format hidden file created by Apple Inc.'s Mac OS X operating system to store custom attributes of a folder such as the position of icons or the choice of a background image.
The '.localized' files just indicate (by their presence) that apps should display the "localized" name for a given folder if one has been defined. So for example, instead of the folder names showing as "Library" or "Users", someone with their language set to "French" in the "International" pref pane would see "Bibliothèque" or "Utilisateurs" in "Finder" or through "Open" and "Save" dialogues.
The .localized file basically makes it use the system's language for files (Mine is in English so it shows English).