## Resource types

### Deleting files from Moodledata manually

This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.
Re: Deleting files from Moodledata manually

I wrote a shell script to remove the files from the moodledata directory simply by doing

select concat("rm -f ",substr(contenthash,1,2),"/",substr(contenthash,3,2),"/",contenthash)from mdl_files where component="backup" and filearea="automated"This generated a list of files with the deletion command, which I could then save as a .sh file and execute.


Average of ratings: -
Re: Deleting files from Moodledata manually

OK, with that you are able to identify all the files you want to erase from de filesystem, but you still have the file entries on the database. Shouldn't you also need to remove those records from the database?

Average of ratings: -
Re: Deleting files from Moodledata manually

Hi Evan,

Nice script, do you take these references out of the database too?

Cheers,

Nathan.

Average of ratings: -
Re: Deleting files from Moodledata manually

Yes, I deleted them from the DB after that.

Average of ratings: -