I am writing my first script which needs to delete a couple of files in that “may” by on any or all of the attached volumes regardless of it’s name… This I’ve taken care of with:
tell application "Finder"
set attachedVolumes to name of every disk
repeat with aVolume in attachedVolumes
set digiBaseFolder to aVolume & ":Digidesign Database"
if digiBaseFolder exists then
delete digiBaseFolder
end if
set digiVolumeFolder to aVolume & ":Library:Application Support:Digidesign:Databases:Volumes"
if digiVolumeFolder exists then
delete digiVolumeFolder
end if
end repeat
end tell
The second task is where I am having a problem, I need to delete some files and folders within the users libtaty, regardless of the user name and covering all users.
The problem is that I can’t work out a way to create a list of users on the system.
Any help would be great.
Duke Stewart.
Model: iBook
AppleScript: Version 2.1 (80)
Browser: Safari 412.5
Operating System: Mac OS X (10.4)
Thanks for the reply, I tried to intergrate your suggestion by adding the following to my original “repeat”:
set myUsersPath to aVolume & ":Users"
set myUsers to name of folders of myUsersPath
repeat with aUser in myUsers
set userPrefsPlist to aUser & ":Library:Preferences:com.digidesign.protools.plist"
set userPrefsDigisetup to aUser & ":Library:Preferences:Digisetup.OSX"
set userPrefsDAE to aUser & ":Library:Preferences:DAE prefs"
try
delete userPrefsPlist
delete userPrefsDigisetup
delete userPrefsDAE
end try
end repeat
But I keep getting the error:
Can’t get every folder of “General:Users”.
FYI - “General” is the current boot partition of my test machine so the setting of the path seems to be working.
This may have been because I tried to be too tricky. Let me explain, the machines I am trying to maintain can have multiple boot partitions/volumes and the program that this all relates to may although shouldn’t find one of the files it needs in/on another partiton/volume if it doesn’t find it on the current partiton/volume.
So I want it to check all attached partitons and volumes.
Any suggestions?
Duke
Model: iBook
AppleScript: Version 2.1 (80)
Browser: Safari 412.5
Operating System: Mac OS X (10.4)
In order to use the “aVolume” reference I had to put your script within my existing repeat, making the entire loop:
tell application "Finder"
set attachedVolumes to name of every disk
repeat with aVolume in attachedVolumes
set digiBaseFolder to aVolume & ":Digidesign Database"
if digiBaseFolder exists then
delete digiBaseFolder
end if
set digiVolumeFolder to aVolume & ":Library:Application Support:Digidesign:Databases:Volumes"
if digiVolumeFolder exists then
delete digiVolumeFolder
end if
set myUsersPath to aVolume & ":Users" as alias
set myUsers to folders of myUsersPath
repeat with aUser in myUsers
try
set Path_aUser_Prefs to (aUser as string) & "Library:Preferences" as alias
delete (items of Path_aUser_Prefs whose name is in {"com.digidesign.protools.plist", "Digisetup.OSX", "DAE prefs"})
end try
end repeat
end repeat
end tell
When I run this I now get a message:
File Network:Users wasn’t found.
And the word alias is high lighted within the editor.