Reputation: 88064
I have a project with literally thousands of image files that aren't being used. The main problem is that they are intermixed with images that are.
Is there a way to get a list of all project artifacts which aren't referenced?
EDIT: Assuming I don't have access to the web logs... Is there an option?
Upvotes: 0
Views: 1055
Reputation: 3982
Basically, no there isn't a straightforward, works-always way. You could build image-references based on user input or other context. So spidering your website means that you have to execute all code paths, otherwise you might throw away stuff that you actually need.
But now for the specific case of Chris, you could use multiple approaches:
Upvotes: 2
Reputation: 11
Another approach -
Assuming all the image files are under one folder, try renaming the folder. The warnings in Visual Studio will tell you the files you need. :)
Upvotes: 1
Reputation: 5787
This was from a previous post.
At a file level:
use wget to aggressively spider the site and then process the http server logs to get the list of files accessed, diff this with the files in the site
diff \ <(sed some_rules httpd_log | sort -u) \ <(ls /var/www/whatever | sort -u) \ | grep something
Upvotes: 0
Reputation: 3747
access your web server logs, parse for GET's of the desired file pattern, unique them, then compare them against your reference list.
or, look at the file access dates (you may need to turn on this feature if you are sysop)
Upvotes: 0