akolpakov / django-unused-media

Remove unused media files from Django project
MIT License
124 stars 24 forks source link

Deletes used files. #21

Closed AliPolat closed 6 years ago

AliPolat commented 6 years ago

Hi,

The command cleanup_unused_media just figures out used files as deletable an deletes them.

Thank You.

My environment: Django 1.11.13 django-unused-media 0.1.11 Windows 7 python 3.4

akolpakov commented 6 years ago

Hi, @AliPolat Can you provide more details?

What is you model structure? Do you use custom fields other than FileField and ImageField to store files?

AliPolat commented 6 years ago

Hi,

I think the the source of the problem:

This is the file get_all_media finds; C:/DjangoProjects/tektas/tektas/media\mail_admin_attachments\2018\06\05\Siparis_Raporu.pdf

And this is the file get_used_media finds; C:\DjangoProjects\tektas\tektas\media\mail_admin_attachments\2018\06\05\Siparis_Raporu.pdf

So because of the direction of slashes both strings treated as different, producing wrong file list to be deleted.

akolpakov commented 6 years ago

Now it is clear where to dig. Windows! )

akolpakov commented 6 years ago

Fixed in v.0.1.12