Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > Hiding Files In Mac OS X?

Hiding Files In Mac OS X?
Thread Tools
ncmason
Guest
Status:
Reply With Quote
May 4, 2007, 07:35 PM
 
I am trying to make an AppleScript that will hide files. I am aware of the "Developer/Tools/SetFile -a V" command for hiding files through Terminal, but had no idea how to use this in an AppleScript. Any suggestions?

Thanks,
Mason
     
mduell
Posting Junkie
Join Date: Oct 2005
Location: Houston, TX
Status: Offline
Reply With Quote
May 4, 2007, 08:28 PM
 
do shell script "Developer/Tools/SetFile -a V"
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
May 4, 2007, 08:54 PM
 
You can also simply append a dot to the beginning of the name (e.g., rename "myfile.txt" to ".myfile.txt"). This will also make it invisible on the command-line as well.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
ncmason
Guest
Status:
Reply With Quote
May 4, 2007, 09:12 PM
 
Originally Posted by mduell View Post
do shell script "Developer/Tools/SetFile -a V"
My plan was that I would use this AppleScript in Automator so I can save it as a plug-in for Finder. I have tried it but it doesn't seem to work. What do I need to add to the AppleScript to make compatible as an Automator Workflow?

Thanks,
Mason
     
ncmason
Guest
Status:
Reply With Quote
May 5, 2007, 02:47 PM
 
Originally Posted by Chuckit View Post
You can also simply append a dot to the beginning of the name (e.g., rename "myfile.txt" to ".myfile.txt"). This will also make it invisible on the command-line as well.
I've tried that and Finder won't allow me to do that. Here is a screenshot of what comes up when I add a "." to the name:

( Last edited by ncmason; May 5, 2007 at 09:46 PM. )
     
Simon
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
May 5, 2007, 03:17 PM
 
Yep, the Finder will intercept that, but any shell will let you do it.

mv foo.bar .foo.bar
     
david_copperfield
Junior Member
Join Date: Jul 2005
Location: N.Ireland
Status: Offline
Reply With Quote
May 5, 2007, 04:42 PM
 
Ye, as simon said use mv command in terminal.

You can use ls -la to view any hidden files. But you won't be able to find it on spotlight, so you'd better remember where your files are. You can use find command to hunt it, but it would take ages.
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
May 5, 2007, 04:56 PM
 
There are also advantages to scripting shell commands and scheduling them via cron. For one, I'm not sure that Applescripts can run faceless? Do they provide console output on error?
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
May 5, 2007, 04:57 PM
 
David Copperfield is a master of knowing how to hide his files... some might say it is.... magic!
     
ncmason
Guest
Status:
Reply With Quote
May 5, 2007, 09:44 PM
 
How can I make it so that it is an Automator workflow?

Thanks,
Mason
     
CharlesS
Posting Junkie
Join Date: Dec 2000
Status: Offline
Reply With Quote
May 6, 2007, 01:35 AM
 
In Automator, make a Run AppleScript action, and enter this script into it:

code:
on run {input, parameters}
set thePath to POSIX path of (input as string)

do shell script "/Developer/Tools/SetFile -a V '" & thePath & "'"

return input
end run
( Last edited by CharlesS; May 6, 2007 at 01:50 PM. )

Ticking sound coming from a .pkg package? Don't let the .bom go off! Inspect it first with Pacifist. Macworld - five mice!
     
david_copperfield
Junior Member
Join Date: Jul 2005
Location: N.Ireland
Status: Offline
Reply With Quote
May 6, 2007, 07:24 AM
 
Originally Posted by besson3c View Post
David Copperfield is a master of knowing how to hide his files... some might say it is.... magic!
Storm, fire, earth, hidden files, heed my call!
     
ncmason
Guest
Status:
Reply With Quote
May 6, 2007, 07:48 AM
 
Originally Posted by CharlesS View Post
In Automator, make a Run AppleScript action, and enter this script into it:

on run {input, parameters}
set thePath to POSIX path of (input as string)

do shell script "/Developer/Tools/SetFile -a V '" & thePath & "'"

return input
end run

edit: okay, formatting is messed up for that snippet since for some reason, the code tag still doesn't work on this board. God forbid it be possible to post code here! After all, this board isn't for technical discussions, it's for talking about whether things are "snappy" or whether "I'd hit it"!
It worked! Thank you so much
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
May 6, 2007, 11:14 AM
 
Originally Posted by CharlesS View Post
edit: okay, formatting is messed up for that snippet since for some reason, the code tag still doesn't work on this board. God forbid it be possible to post code here! After all, this board isn't for technical discussions, it's for talking about whether things are "snappy" or whether "I'd hit it"!

So, would you hit it?


*ducks*
     
CharlesS
Posting Junkie
Join Date: Dec 2000
Status: Offline
Reply With Quote
May 6, 2007, 01:32 PM
 
Originally Posted by besson3c View Post
So, would you hit it?


*ducks*
Hmm, I've partially figured it out. Apparently, the code tag has been renamed to [codeff] instead of [code] for some reason (just to be confusing?). However, it's still ignoring my line indents. Off to the feedback forum...
( Last edited by CharlesS; May 6, 2007 at 01:52 PM. )

Ticking sound coming from a .pkg package? Don't let the .bom go off! Inspect it first with Pacifist. Macworld - five mice!
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
May 6, 2007, 01:50 PM
 
Originally Posted by CharlesS View Post
I'd hit whoever decided to disable the code tag - in the face.

Seriously, I wish someone would explain to me why that decision was made, because it makes no sense to me at all.
It was a mistake, I think, where it was being redesigned and Frank just forgot to finish it. There's still a preliminary version of the tag available as [codex].
[codex]See?[/codex]
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
May 6, 2007, 01:52 PM
 
[codex]practicing writing code[/codex]


[codex]more code[/codex]


[codex]Here is some more code: 24hfh1s33^^[/codex]


Awesome!
     
CharlesS
Posting Junkie
Join Date: Dec 2000
Status: Offline
Reply With Quote
May 6, 2007, 02:25 PM
 
[codex]#include <stdio.h>

int main (int argc, const char * argv[]) {
printf("This should be indented!\n");
return 0;
}[/codex]

[codex]set thePath to "Macintosh HD:Users:meocuments:file.txt"[/codex]
[codex]NSData *myData = [NSData dataWithContentsOfFileathToFile];[/codex]
Not so awesome.

Ticking sound coming from a .pkg package? Don't let the .bom go off! Inspect it first with Pacifist. Macworld - five mice!
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
May 6, 2007, 02:32 PM
 
Originally Posted by CharlesS View Post
Not so awesome.
I don't think the old code tag turned off the auto-smilies feature either.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
CharlesS
Posting Junkie
Join Date: Dec 2000
Status: Offline
Reply With Quote
May 6, 2007, 06:53 PM
 
Originally Posted by Chuckit View Post
I don't think the old code tag turned off the auto-smilies feature either.
I seem to remember it doing that, but of course now it's not possible for me to check, so who knows.

I do remember that it definitely did display indentations if you had tabs or other white space in the code.

Ticking sound coming from a .pkg package? Don't let the .bom go off! Inspect it first with Pacifist. Macworld - five mice!
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
May 6, 2007, 07:19 PM
 
Auto smilies? That would be awesome!
     
Cadaver
Addicted to MacNN
Join Date: Jan 2003
Location: ~/
Status: Offline
Reply With Quote
May 9, 2007, 11:44 PM
 
[codex]
Hide pr0n /shemales/videos/hardcore
[/codex]
     
jasong
Mac Elite
Join Date: Mar 2000
Location: Allston, MA, USA
Status: Offline
Reply With Quote
May 12, 2007, 06:01 PM
 
Also, I have noticed sometimes the Finder needs to be restarted to recognize that the files are now set to be invisible. Actually, I think it's usually folders that requires a Finder restart.
-- Jason
     
Pyoko
Fresh-Faced Recruit
Join Date: May 2007
Location: pyo
Status: Offline
Reply With Quote
May 14, 2007, 12:53 PM
 
Iunno about plugins for Automator, but I keep this in my dock, pyo.

Hide'N'Seek

I made it out of a few different pieces of applescripts I found out thar on teh internets, and it's what I use to hide my secret cookie recipes from the nosy neighbor lady, pyo.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 06:49 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,