• 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: Delete an Invisible File
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Delete an Invisible File


  • Subject: Re: Delete an Invisible File
  • From: Brian Christmas <email@hidden>
  • Date: Fri, 19 Feb 2010 10:23:15 +1100


On 19/02/2010, at 8:59 AM, Steve Valenti wrote:

I need to create a script to delete an invisible file in a folder. The folder will be on a mounted SMB drive file server. I’m not seeing how I can reference the invisible file since this bit won’t work.
 
tell application "Finder"
       delete (every file of folder "PathToFolder" whose name is ".DS_Store")
end tell
 
I’m guessing this might be a job for a shell script but I don’t know any shell scripting to use the “do shell” command in AppleScript. Can anyone give me a hand?
The reason I need to delete this file is because when I try to copy a folder that contains this file to a Microsoft SharePoint server, it errors.


G'day Steve

The following script will remove the .DS_Store, but be warned, once theDS_Store has been created in the folder, and addressing or opening of the folder will re-create the DS_Store file. So running the script once will remove the file, running it a second time gives an error that the DS_Store can't be found, but running it a third time will trash the DS_Store again.

I think if you warp the trash line in a try statement, followed by your move to server code, you should be ok.

Regards

Santa

set ptd to path to desktop
set ptf to ptd & "untitled folder:.DS_Store" as text
tell application "Finder"
move ptf to trash
end tell

 _______________________________________________
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

References: 
 >Delete an Invisible File (From: "Steve Valenti" <email@hidden>)

  • Prev by Date: Re: Delete an Invisible File
  • Next by Date: The agony of debugging Folder Actions
  • Previous by thread: Re: Delete an Invisible File
  • Next by thread: The agony of debugging Folder Actions
  • Index(es):
    • Date
    • Thread