• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How can I control invisible files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I control invisible files


  • Subject: Re: How can I control invisible files
  • From: Robert Poland <email@hidden>
  • Date: Fri, 02 Nov 2012 21:17:08 -0600

Hi,

I like Doug's approach but I'm having trouble with the syntax.

tell application "Finder"
set winTarget to target of front window as alias
end tell

set fileList to list folder winTarget with invisibles

if fileList contains ".DS_Store" then
set _file to quoted form of (POSIX path of (winTarget as text) & ".DS_Store")
do shell script "sudo cp /dev/null  _file"
end if


On Nov 2, 2012, at 7:15 PM, Christopher Stone <email@hidden> wrote:

On Nov 02, 2012, at 18:28, Robert Poland <email@hidden> wrote:
I just discovered that when scripting Finder windows (size, location, etc.), if they misbehave, deleting the .DS_Store file helps.

Only problem is that, appables must be visible to delete them.

Question; Is there a way to detect and control the Hide/Show Invisibles.
______________________________________________________________________

Hey Bob,

I believe it is necessary to run a 'defaults' command from the shell and then quit and restart the Finder to show/hide invisibles, and that to quote Ron is "expensive".

This is fast and reliable.

---------------------------------------------------------------------------

tell application "Finder"
set winTarget to target of front window as alias
end tell

set fileList to list folder winTarget with invisibles

if fileList contains ".DS_Store" then
set _file to quoted form of (POSIX path of (winTarget as text) & ".DS_Store")
do shell script "rm " & _file
end if

---------------------------------------------------------------------------

You can of course use the alias trick to verify the .DS_Store file's existence, or you can use 'ls' or 'file' from the shell, or you can play with System Events.

--
Best Regards,
Chris


Robert Poland - Fort Collins, CO



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: How can I control invisible files
      • From: Doug McNutt <email@hidden>
References: 
 >How can I control invisible files (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: How can I control invisible files
  • Next by Date: Re: How can I control invisible files
  • Previous by thread: Re: How can I control invisible files
  • Next by thread: Re: How can I control invisible files
  • Index(es):
    • Date
    • Thread