visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Operating Systems :: Unix :: deleting files


By: roe1and Great Britain  Date: 23/04/2008 12:17:00  English  Points: 20 Status: Answered
Quality : Excellent
i want to delete all the .old files in a directory and its subdirectories. the subdirectories are about 4 deep. i've tried rm -rf *.old but i think this only goes one deep? i could use a php or perl script but it seems to me that the unlink() function is extremely slow. any ideas?
By: VGR Date: 23/04/2008 21:08:30 English  Type : Answer
I think rm ha a "recursive search" switch, but I may be wrong.
personally, I would do something like this :

rm -f < find / -name *.old [s]


where [s] is the proper find switch for recursive search. make sure find returns full pathes. Then pass the files list to rm -f

as for unlink(), it's not as slow as you think. It should be mapped to the fastest OS dependent function. In your case, the destruction of the inode, or a "rm"

using PHP, you're right, a recursive function with readdir() would do, or a de-recursified version with a maximum depth, say 5 in your case.

All not that difficult.

Come back again in case of errors or details needed.

Do register to be able to answer

EContact
browser fav
page generated in 337.924960 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page