Moving and Deleting files

So there are Two things i need done and i can’t figure it out…

  1. a folder action that when a file is put into the folder then all other files in that folder are deleted, and only the file you put in there remains

  2. a Droplet that puts a file that you drop on it into each of several shared folders on different macs across the building

I am working on this and would love some help

Hi,

try this


on adding folder items to this_folder after receiving these_items
	set nameList to {}
	repeat with oneItem in these_items
		set end of nameList to name of (info for oneItem)
	end repeat
	tell application "Finder"
		set filesOfFolder to files of this_folder
		repeat with oneFile in filesOfFolder
			if name of oneFile is not in nameList then delete oneFile
		end repeat
	end tell
end adding folder items to
  1. assumes, that all shared volumes are mounted, there is no error handling

property folderList : {"/Volumes/myVolume1/path/to/folder1/", "/Volumes/myVolume2/path/to/folder2/"}

on open theseItems
	repeat with oneItem in theseItems
		repeat with oneFolder in folderList
			do shell script "/bin/cp " & quoted form of POSIX path of oneItem & space & quoted form of oneFolder
		end repeat
	end repeat
end open

So now that I have talked to and showed things to my boss things have changed.

So here is the folder architecture

  • Folders
    x Files

-Digital Signage
-Back Up
x old sign.keynote
-Play
x Sign.keynote

So what we need is when you move a Video or Keynote into Play the file that is in the folder is moved to Backup and the File you put into Play stays there

I know that all that all that needs to be changed is the delete action but i am unsure how to a address folders i have been trying to find a book to learn applescript i just don’t know which one to look for.