If you like DNray Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...

 

Deleting unused files on webhosting

Started by AlwayzBluFFinG, Feb 23, 2023, 03:44 AM

Previous topic - Next topic

AlwayzBluFFinGTopic starter

Hey there!

I have been tasked with maintaining several dozen websites, some of which date back to when they were worked on by about 10-15 people. Over time, a lot of unnecessary files like unused HTML pages, style files, and pictures have accumulated on these sites. It's been taking me ages to sift through all these files manually.

Do any of you have any advice on how to automate this process? I would greatly appreciate any help you can offer.

Thanks!
  •  


magicyan

In my opinion, clearing out the tmp folder and cleaning logs and mail is definitely feasible, especially if the hosting is under your control. Doing so can free up a substantial amount of space.

However, tackling everything else may be a bit challenging and requires caution. Unfortunately, I don't have much advice on automating this process beyond what I've already mentioned.

Good luck with your cleanup!
  •  

Cviki

To copy files to your computer, create a new "site" in Dreamweaver for each website. Once you've done this, you can use Dreamweaver's built-in search function to look for any orphaned files (go to Site, Check links sitewide (Ctrl+F8), and filter by orphaned files in the results).

Even the trial version of Dreamweaver should suffice for this task, although keep in mind that the hotkeys might be slightly different in newer versions. Personally, I've found this method to work quite well, as long as the file names aren't calculated dynamically anywhere in your sites.
  •  

reeze

To be frank, it's hard to offer a surefire solution for your problem. In fact, the risk of accidentally deleting important content is quite high; even using teleportation won't help you locate pages that aren't linked to from other pages but have external links pointing to them.

One possible approach is to download the sites onto your computer and clean them up manually (again, using teleportation). If you accidentally delete something important, you can always restore it from a backup copy.

In any case, the best solution in the long term would be to simply upgrade your storage capacity, as disk space is relatively inexpensive these days. This will allow you to maintain multiple backups and preserve your files more effectively.
  •  

jeriSemi

You can use a programming language like Python, Ruby, or JavaScript to create a script that can traverse through the directories of each website and identify and remove unnecessary files. For example, in Python, you can use the os and shutil modules to navigate the file system, identify unused files, and delete them programmatically.

Another detailed approach is to utilize command-line tools such as grep, find, and xargs. You can use the find command to search for specific file types (e.g., HTML pages, style files, images) and remove them based on criteria such as last accessed time or file size.

For those who prefer third-party tools, there are dedicated website maintenance software available that offer automated cleanup features specifically designed for identifying and removing unused files. These tools often provide detailed reports on the files that can be safely deleted, giving you control over the cleanup process.

In all cases, it's crucial to exercise caution and ensure backups are in place before executing any automated cleanup processes. Additionally, consider creating a testing environment to run your automation scripts or tools on a copy of the websites to validate their impact before implementing changes on the live sites.

By taking a detailed and systematic approach to automating the cleanup process, you can streamline website maintenance, improve performance, and ensure that your websites remain free from unnecessary clutter. If you need further details or assistance on any of these approaches, feel free to reach out.
  •  

alexcray

Quote from: AlwayzBluFFinG on Feb 23, 2023, 03:44 AMHey there!

I have been tasked with maintaining several dozen websites, some of which date back to when they were worked on by about 10-15 people. Over time, a lot of unnecessary files like unused HTML pages, style files, and pictures have accumulated on these sites. It's been taking me ages to sift through all these files manually.

Do any of you have any advice on how to automate this process? I would greatly appreciate any help you can offer.

Thanks!

Analyze server logs to identify which pages are actually being accessed and prioritize cleaning irrelevant ones.
  •  


If you like DNray forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...