I will pay by PayPal to those who can help me please!

Hi,

This is my 2nd post, I couldn’t work out how to do it from Johnn8’s post the first time. I’d be eternally grateful if someone could help in modifying this script for my needs. I have most of the code…What I want to be able to do is to delete the contents of the hidden folder '/TheVolumeSettingsFolder/HFSExtentTables. I have a problem though I want to be able to delete the contents of the folder on ALL volumes, regardless of how many partitions you have (there are multiple copies of the HFSExtentTables folder depending on how many drives you have).

A kind friend from this forum (johnn8 I think) suggested that to find the files on all volumes you could run the script below.

set the_volumes to list disks
set the_folder to “:.HFSExtenttables:” --set this to the name of the folder (he says that you have to have a .in front for a hidden file - is this correct or do I have to specify the whole path e.g. ":.TheVolumeSettingsFolder.:.HFSExtenttables:)?
repeat with this_volume in the_volumes
try
set this_folder to (this_volume & the_folder) as alias --do something with this_folder if it is found, so we need to delete contents, not sure how to do this…
end try
end repeat

I would like to do something similar to rebuild the desktop files on OS 9 and X by deleting the desktop files. I have used the following script in the Terminal. I want to rebuild all the desktop files on all volumes too - perhaps I could use the script above to detect all desktop files as well? The following is for the Terminal. I made the file executable by saving the file as Rebuild.txt and making it executable with the command: sudo chmod a+x. Can it be done in AppleScript this way?

#!/bin/sh

sudo rm /Desktop DB
sudo rm /Desktop DF
sudo sync
sudo reboot

I think this will only rebuild the OS 9 desktop file though am I right? I’m a little unsure of the syntax of Applescript to write my own version.

I am so desperate to get this working I am willing to pay some money by PayPal to anyone who gets it working if they like.

I found this script below that supposedly rebuilds the desktop for OS x 10.2 but it doesn’t seem to work for 10.3 on my system.

Your help would be much appreciated.
Thanks.

v10.2 OS X Desktop Rebuild Script from MacScripter:

set goAhead to “Yes”
set backUp to “Back up first”

tell application “Finder”
set machome to (home as text)
set unixhome to (POSIX path of machome)
end tell

set prefDir to “” & unixhome & “/Library/Preferences/”
set backupDir to “” & unixhome & “/Desktop/Desktop_Backup_Files”

display dialog “This script will attempt to ‘‘rebuild your desktop’’ by removing 6 files in your Home Preferences folder.” & ¬
return & return & “Remove them now?” buttons [“Cancel”, backUp, goAhead] default button 1

if result’s button returned = goAhead then
tell application “Finder”
if (file “LSApplications” of folder “Preferences” of folder “Library” of home exists) and ¬
(file “LSClaimedTypes” of folder “Preferences” of folder “Library” of home exists) and ¬
(file “LSSchemes” of folder “Preferences” of folder “Library” of home exists) then
set thecommand to “rm “” & prefDir & “LSApplications” “” & prefDir & “LSClaimedTypes” “” & prefDir & “LSSchemes”; rm “” & prefDir & “.LSApplications_Backup” “” & prefDir & “.LSClaimedTypes_Backup” “” & prefDir & “.LSSChemes_Backup””
do shell script thecommand
tell application “Finder”
open folder “Preferences” of folder “Library” of home
close front window
end tell
tell application “Finder”
if (file “LSSchemes” of folder “Preferences” of folder “Library” of home) exists then
activate
display dialog “ARGH!” & return & return & ¬
“Files were not successfully removed.” buttons [“Cancel”, “Check again”]
if result’s button returned = “Check again” then
tell application “Finder”
if ((file “LSSchemes” of folder “Preferences” of folder “Library” of home) exists) is false then
display dialog “YAY! Files WERE removed!” & return & return & ¬
“You need to restart your computer for the changes to take effect.” & return & ¬
“(to restart select Restart from the Apple menu)” & return & return & ¬
“That’s it!” buttons [“Cool!”] default button 1
else
display dialog “ARGH!” & return & return & ¬
“Files were not successfully removed.” buttons [“Grrr”]
end if
end tell
end if
else
tell application “Finder”
activate
display dialog “Removal of files was successful!” & return & return & ¬
“You need to restart your computer for the changes to take effect.” & return & ¬
“(to restart select Restart from the Apple menu)” & return & return & ¬
“That’s it!” buttons [“Cool!”] default button 1
end tell
end if
end tell
else
activate
display dialog “I couldn’t find the files I need to remove.” buttons [“OK”] default button 1
end if
end tell
else if result’s button returned = backUp then
tell application “Finder”
if (file “LSApplications” of folder “Preferences” of folder “Library” of home exists) and ¬
(file “LSClaimedTypes” of folder “Preferences” of folder “Library” of home exists) and ¬
(file “LSSchemes” of folder “Preferences” of folder “Library” of home exists) then
do shell script “mkdir “” & backupDir & “”; cp “” & prefDir & “LSApplications” “” & backupDir & “”; cp “” & prefDir & “LSClaimedTypes” “” & backupDir & “”; cp “” & prefDir & “LSSchemes” “” & backupDir & “””
tell application “Finder”
set goBack to “Go Back”
if (file “LSApplications” of folder “Desktop_Backup_Files” of folder “Desktop” of home exists) and ¬
(file “LSClaimedTypes” of folder “Desktop_Backup_Files” of folder “Desktop” of home exists) and ¬
(file “LSSchemes” of folder “Desktop_Backup_Files” of folder “Desktop” of home exists) then
activate
display dialog "The 3 visible files have been safely copied to " & backupDir & “” buttons [“Cancel”, goBack] default button 2
if result’s button returned = goBack then
activate me
run me
end if
else
display dialog “ARGH!” & return & return & “Files were not successfully backed up.” buttons [“Damn it”]
end if
end tell
else
activate
display dialog “I couldn’t find the files I need to back up.” buttons [“OK”] default button 1
end if
end tell
end if

I don’t have the HFSExtentTables folder on my system but unless there is a permission issue, I don’t see why this wouldn’t work:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

Thanks for your reply…I did try your original method. I was unable to check if it worked completely though. Is there a way of checking the status to see if it has carried it out? I guess I could try and integrate the OS X 10.2 desktop rebuild error-checking that is in the script I attached at the bottom of my post.
I will try to use your method with the DB and DF destop files, hopefully it will work?

I appreciate your reply, I really do :slight_smile:

I think we all have that hidden folder, we can’t find it by searching normally it seems. It is there if you turn hidden files on with TinkerTool. I can only seem to find it with Norton fast Find though :-(.

Thanks again - anyone else have any ideas?

Appearently TheVolumeSettingsFolder dir exists in Mac OS X 10.2 <. I have Jaguar 10.2 on another drive but it does not have the HFSExtentTables in the above directory. It does have DesktopPrinters DB and OpenFolderListDF, but that is all. TheVolumeSettingsFolder folder is not present in 10.3 (Panther).

There are a couple of utilities to rebuild the desktop at MacUpdate.com (search for rebuild desktop), SubRosa Software has the best reviews…

http://macupdate.com/info.php/id/11897