Delete .ds_Store form folder

I am looking to create an AppleScript to choose folder and run the fallowing script do shell script "rm .ds_Store "

You may try :

set leDossier to choose folder
set dsStore to (leDossier as text) & ".DS_Store"
tell application "System Events" to set dsAvailable to exists disk item dsStore
if dsAvailable then do shell script "rm " & quoted form of POSIX path of dsStore

Yvan KOENIG running El Capitan 10.11.1 in French (VALLAURIS, France) mardi 27 octobre 2015 15:03:25

Do you have the script in english?

A script is always in English.

The names of variables have no meaning of their own.

If I name one G_W_Busch or The_Butcher or Saddam_Hussein or even sonOfAbiche, it will make no difference - exactly as in real life !

In my script there is one variable with a French name : leDossier.
Even a children of 5 years may understand what it means as it is the result returned by the function “choose folder”.

I always assume that askers are adults so they are supposed to be able to do, at least, what a 5 years old children do.

You may replace leDossier by azertyuiopqsdfghjklmwxcvbn, the script will work exactly the same.
Replace leDossier by the Folder if you want. I will not do that for you !

Yvan KOENIG running El Capitan 10.11.1 in French (VALLAURIS, France) mardi 27 octobre 2015 19:41:51

What a much easier answer from Yvan was:

set theFolder to choose folder
set dsStore to (theFolder as text) & ".DS_Store"
tell application "System Events" to set dsAvailable to exists disk item dsStore
if dsAvailable then do shell script "rm " & quoted form of POSIX path of dsStore

Easy tiger :wink: