Forum Moderators: phranque

Message Too Old, No Replies

Get Rid Of Unreferenced / Unlinked Files

         

troyaxn

4:59 am on Dec 22, 2006 (gmt 0)

10+ Year Member



as your website gets older, its number of files will also get bigger and bigger. sometimes, some of these files are no longer referenced from any html files!.
how are you going to get rid of these unreferenced, unlinked files and delete it completely out of your document root?.
please help, my document root itself already reached 1GB+ and increasing!...

thanks!

physics

6:28 am on Dec 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you're on Linux you might be able to use find
[oreillynet.com...]

So something like (back up first!)


cd /your/webroot
find ./ -atime +100 -exec rm -f {} \;

The atime option allows you to tell find to find files that were last accessed N days ago (in this case 100). Note that important files that are rarely accessed could still be deleted so use discretion.


Disclaimer: Not responsible if you blow away important files ;)

limbo

12:57 pm on Dec 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Good Question!

If your remote server is synced with your local files then I know you can use Dreamweaver to seek orphans (files that are not linked to another)

This is found:

> site menu
> check links site wide
> then select orphans

this will identify not only orphaned graphic files but other file types too.

Not sure how DW holds up to PHP & ASP includes and such - but I imagine there is other software with similar capability too.

[edited by: encyclo at 2:35 am (utc) on Dec. 23, 2006]
[edit reason] spliced from duplicate thread [/edit]