Finder hiding specific file by name At some time my MBA 10.8 Finder decided (or was it me) to hide certain files from me.

Here is the example (I have few other files like it)


  ..  The Water Horse.flv




Originally those files are downloaded from the web in Firefox using the add- on called Ant.com.

I can still see the files in VLC player, or in the OminDiskSweeper.

I can also see the files using the show hidden files in Terminal.

defaults write com.apple.finder AppleShowAllFiles TRUE &amp;&amp; killall Finder


It used to be not so, but something changed, or I changed without knowing.

My investigation showed it has to do with the beginning of the file name (..  ) that is no longer striped by the download program.

If I remove the beginning of the file name it goes back to normal, but unfortunately the files are named like that originally on the web site.

So I tried the revers process by adding the dot in front and it tells me I should not do that. How do I tell my OS to show those files in Finder with that name or how do I strip the beginning of the file name during or after download process, or am I stuck with the show all hidden files.



Is there a way to change the name of the file before or during or after download, so I do not have to use Terminal each time to unhide all files then hide again.
Any file or folder that begins with '.' is going to be hidden in the Finder. That has always been true, back to the days of NeXTStep.

If what you are trying to do is automatically rename files that begin with a '.' to not begin with a '.' that can easily be accomplished with a shell script. Save the following as /usr/local/bin/rename-dot-files.sh:

#!/bin/zsh -f

DIR="$HOME/Downloads/"

cd "$DIR"

ls -1Ad \.* | egrep -v '.DS_Store|.localized' | while read line
do

        NEWNAME=$(echo "$line" | sed 's#^\.##g')

        /bin/mv -vn "$line" "$NEWNAME"

done

exit 0


That script will look in $HOME/Downloads/ for any files that start with a . (excluding .DS_Store and .localized which you do not want to rename) and will rename it to the same name, without the '.' as long as there is no other file/folder with that same name.

To do this automatically you will need to create a launchd plist that will automatically launch any time the directory changes:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;Disabled&lt;/key&gt;
    &lt;false/&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;com.tjluoma.rename-dot-files&lt;/string&gt;
    &lt;key&gt;Program&lt;/key&gt;
    &lt;string&gt;/usr/local/bin/rename-dot-files.sh&lt;/string&gt;
    &lt;key&gt;RunAtLoad&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;WatchPaths&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;/Users/luomat/Downloads/&lt;/string&gt;
    &lt;/array&gt;
&lt;/dict&gt;
&lt;/plist&gt;


Obviously you'll want to change the path from /Users/luomat/ to whatever your $HOME is.

Save that plist to ~/Library/LaunchAgents/com.tjluoma.rename-dot-files.plist and then load it as:

launchctl load ~/Library/LaunchAgents/com.tjluoma.rename-dot-files.plist


The script will run whenever the ~/Downloads/ is changed, which includes any files being added or removed, but it automatically limits itself to files which begin with '.'