Hi
I wanted to delete a 450GB archive from a network drive (Seagate Central) without reformatting the drive. I tried 3 ways:
(1) straight from the finder,
(2) a recursive delete routine (pasted in at the end) that I think I picked up on the NUG,
(3) From the terminal - sudo rm -rf /Directory_to_delete.
They all took an age:
(1) seemed to choke after counting around 2 million files and never got to the point of deleting anything.
(2) worked away and might delete 20 or so files in a minute for several hours, but then it seemed to slow and do less and less and I felt I had to crash it out. I called it from a thread, passing the parent directory to start if off. Every few seconds I’d read DelCount which was an Integer on the Window and display it for signs of life.
(3) Chugged away and eventually - three and a half days later - the backup was deleted.
Three and a half days! OK, it worked from the terminal but I’d imagined it would be way quicker. Any advice how I ought to have approached this?
Many thanks - Richard.
[code]Sub RecursiveDelete(f as FolderItem)
Dim i, c as Integer
if f=nil or f.exists=false then
return
end
if f.directory then //its a folder
c = f.count
for i= c downto 1 //go through each item
RecursiveDelete(f.TrueItem(i))
next
if c=0 then
f.locked = false
f.delete
DelCount = DelCount+1
'beep
end
else
f.locked = false
f.delete
DelCount = DelCount+1
end
End Sub
[/code]