Skip to end of metadata
Go to start of metadata


Let's say you've removed a file from a page by deleting the link, or by replacing that link with a newly uploaded file. However, people are still finding the old file by way of outdated links or via Google. How do you remove this old file so people can't find it any more?

The short answer is this: the same way you uploaded the file. 

Table of Contents


Delete files via the File Manager (IMCE)

In the same way the you upload PDF files, documents and images with the File Manager (see  Drupal 8 - Inserting PDFs and other Documents or Drupal 7 - Working with Basic Pages - Inserting PDFs ), you can find files and delete them.

Note: In Drupal 8, you can also see where and how files are used on the site by going to Content and clicking the "File" tab. In fact, you may want to do this first. You can follow my instructions for finding where files are used below.

My screenshots below are from a Drupal 8 site-- specifically, Anthropology's Drupal 8 site. Your site may look a little different, but the instructions are the same.

1) Create a Basic Page.

We won't end up saving the page; this is just a way for us to access the File Manager.

2) Click the Link icon, then click the blue Upload a File text.

3) This brings you to the File Uploader/Manager, where you can add and remove files.

You can delete files from here. Look for the file you want to delete. You may have to look for it in the folders, such as inline-files.

4) Click on it to select it, then click the "Delete" option at the top of the file manager.

Note: If the file is at use anywhere on the site, the file manager will  not allow you to delete it (see my section below, "Figuring out where Files are on the Site"). 
Also, please be careful when deleting content. If you delete something you did not intend to, you will have to re-upload it to get it back. 

5) Done!

You can exit out of the File Manager and Basic Page.
You  don't need to save the Basic Page; it was just a way for us to access the File Manager.

Drupal 8 Only: Figuring out where files are used on the site

In our newest sites, such as Anthropology and any site built in 2017 or later, you can see all the files that are uploaded on the site, and what specific pages are linking to them.
This could be useful to you if you are trying to decide what version of a file to remove.

1) Under "Content," click on the tab called "Files" 

It's all the way to the right. If you don't see it, you are either on a Drupal 7 site, or you don't have sufficient permissions. In the latter case, you can talk to the person from your department who is in charge of the website and ask for their help.

2) Search for a file using part of the title

When you search for a File using a keyword or partial title, you can see all the files uploaded, and what pages they are being used on, if at all.
In the below example, when I searched for "Hague," I found several files. Some are not being linked to at all, as indicated by the right-most column. 


3) Click on the file to view it, or mouse over it to see its location in the file structure


You can view the files by clicking on them, and mouse over them to see the url of the file, and learn if the file is in any special folder, other than sites/default/files.
For example, the first file below is also in sites/default/files/inline-files, which I can see by looking at the url at the bottom of the browser.

So going back to my first set of instructions, if this was the file I wanted to remove, I would go into the File Manager, look in the Inline Files folder, and remove that. (Except that the File manager probably wouldn't let me remove the file because it is being used in two places. So I would have to go into those pages and remove those links from them first.)