File will not delete

hawkeyefxr

macrumors newbie
Original poster
Jul 12, 2012
25
0
I have a file called .DS_store on the desktop that will not delete. I have renamed it and deleted it and it just reappears again.
If i copy it to downloads it is greyed out so i take it it is a hidden file ?
 

Nermal

Moderator
Staff member
Dec 7, 2002
18,811
1,286
New Zealand
It should indeed be hidden. It's normal for it to be recreated, but it's not normal for it to show up. Try doing this in a terminal:

chflags hidden ~/Desktop/.DS_Store
 
  • Like
Reactions: Weaselboy

Weaselboy

Moderator
Staff member
Jan 23, 2005
30,437
10,243
California
That file contains the Finder settings (like column order etc) for the Desktop folder. Like Nermal said, it would normally be a hidden file. Have you been messing about in Terminal or some utility that may have caused hidden files to be shown?
 
  • Like
Reactions: mag01

mag01

macrumors regular
Apr 10, 2011
148
41
It should indeed be hidden. It's normal for it to be recreated, but it's not normal for it to show up. Try doing this in a terminal:

chflags hidden ~/Desktop/.DS_Store
Actually any files/directories whose names start with the dot character (dot files) are treated as hidden and thus it shouldn't be necessary to set their hidden flag. Thus as Weaselboy suggets, the OP has most likely (maybe inadvertently) changed the Finder settings to show such hidden files. Usually it's the following setting (commands for the Terminal follow):

- to verify the current value - normally it should return an error "The domain/default pair of (/Users/.../Library/Preferences/com.apple.finder, AppleShowAllFiles) does not exist" or value "0":
Code:
defaults read com.apple.finder AppleShowAllFiles
- to enable - e.g. reveal hidden files:
Code:
defaults write com.apple.finder AppleShowAllFiles -boolean TRUE
killall Finder
- to disable - e.g. revert to the default state when hidden files are not shown:
Code:
defaults delete com.apple.finder AppleShowAllFiles
killall Finder
 
Last edited:

Nermal

Moderator
Staff member
Dec 7, 2002
18,811
1,286
New Zealand
Actually any files/directories whose names start with the dot character (dot files) are treated as hidden and thus it shouldn't be necessary to set their hidden flag.
I know :) but it was just something to try. I didn't know how to set Finder to show/hide hidden files, but it sounds like that's a better solution.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.