# Media Papierkorb über Konsole löschen

**URL:** <https://forum.shopware.com/t/media-papierkorb-uber-konsole-loschen/33000>\
**Category:** Administration\
**Created:** [14. Dezember 2015 um 14:58 UTC](https://forum.shopware.com/t/media-papierkorb-uber-konsole-loschen/33000 "2015-12-14T14:58:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tigersoft](https://avatars.discourse-cdn.com/v4/letter/t/71c47a/32.png) [@Tigersoft](https://forum.shopware.com/u/Tigersoft)\
**Post date:** [14. Dezember 2015 um 14:58 UTC](https://forum.shopware.com/t/media-papierkorb-uber-konsole-loschen/33000/1 "2015-12-14T14:58:29Z")

</div>

Mit dem Konsole Befehl sw:media:cleanup kann ich nach einem Import alte ungenutzte Bilder in den Papierkorb schieben. Das klappt prima. Jetzt brauche ich aber noch den Konsole Befehl, um den Papierkorb danach zu leeren. Dazu ist hier [http://community.shopware.com/Shopware- … \_1650.html](http://community.shopware.com/Shopware-CLI%5C_detail%5C_1650.html) nichts dokumetiert.

---

<div class="post-metadata">

**Author:** ![DanielNogel](https://avatars.discourse-cdn.com/v4/letter/d/96bed5/32.png) [@DanielNogel](https://forum.shopware.com/u/DanielNogel)\
**Post date:** [14. Dezember 2015 um 15:24 UTC](https://forum.shopware.com/t/media-papierkorb-uber-konsole-loschen/33000/2 "2015-12-14T15:24:10Z")

</div>

Hi, es gibt einen ‘–delete’ switch, der macht das 🙂 Besten Gruß, Daniel

---

<div class="post-metadata">

**Author:** ![Tigersoft](https://avatars.discourse-cdn.com/v4/letter/t/71c47a/32.png) [@Tigersoft](https://forum.shopware.com/u/Tigersoft)\
**Post date:** [14. Dezember 2015 um 15:42 UTC](https://forum.shopware.com/t/media-papierkorb-uber-konsole-loschen/33000/3 "2015-12-14T15:42:42Z")

</div>

Klasse, danke für die prompte Antwort. Jetzt fehlt mir nur noch der Schalter, der verhindert, dass der Konsole Befehl nachfragt, ob ich wirklich löschen möchte. Der Schalter heißt -n. So ganz am Ziel bin ich noch nicht, denn der Papierkorb ist voll, sehr voll, und ich bekomme nun einen Speicherfehler wenn ich sw:media:cleanup --delete -n aufrufe. Gibt es noch einen anderen Weg, die Bilder überhaupt einmal weg zu bekommen, ohne 400 Seiten im Media-Manager einzeln zu löschen?

---

<div class="post-metadata">

**Author:** ![derkosta](https://avatars.discourse-cdn.com/v4/letter/d/65b543/32.png) [@derkosta](https://forum.shopware.com/u/derkosta)\
**Post date:** [14. Dezember 2015 um 21:48 UTC](https://forum.shopware.com/t/media-papierkorb-uber-konsole-loschen/33000/4 "2015-12-14T21:48:39Z")

</div>

das problem hatte ich auch. du kannst das memorylimit für dein consolen php hochsetzen mittels `php -d memory\_limit=280M my\_script.php` für den ersten Aufruf ist das script leider auch auf consoleneben sehr speicherhungrig. anders gehts nicht

---

<div class="post-metadata">

**Author:** ![Tigersoft](https://avatars.discourse-cdn.com/v4/letter/t/71c47a/32.png) [@Tigersoft](https://forum.shopware.com/u/Tigersoft)\
**Post date:** [15. Dezember 2015 um 16:29 UTC](https://forum.shopware.com/t/media-papierkorb-uber-konsole-loschen/33000/5 "2015-12-15T16:29:54Z")

</div>

Super, alles wieder clean!

---

<div class="post-metadata">

**Author:** ![Ludwig](https://avatars.discourse-cdn.com/v4/letter/l/43a26b/32.png) [@Ludwig](https://forum.shopware.com/u/Ludwig)\
**Post date:** [28. Juni 2016 um 13:01 UTC](https://forum.shopware.com/t/media-papierkorb-uber-konsole-loschen/33000/6 "2016-06-28T13:01:04Z")

</div>

Wow, super Sache. Muss man eigentlich danach noch sw:thumbnail:cleanup durchführen, um wirklich allen ungenutzten Inhalt zu löschen?

Grüße  
ludwig

---

<div class="post-metadata">

**Author:** ![webadm](https://avatars.discourse-cdn.com/v4/letter/w/c6cbf5/32.png) [@webadm](https://forum.shopware.com/u/webadm)\
**Post date:** [11. Januar 2017 um 16:14 UTC](https://forum.shopware.com/t/media-papierkorb-uber-konsole-loschen/33000/7 "2017-01-11T16:14:10Z")

</div>

Hallo zsuammen,

ich habe ein ähnliches Problem. Leider haben sich in der Zwischenzeit so viele Bilder im Papierkorb gesammelt, dass er sich auch nicht mehr über die Konsole löschen lässt.&nbsp;

Der Aufruf über die Konsole wird mit “Killed” quittiert, auch wenn ich memory\_limit bis auf 16000M setze. Vorher werde ich noch gefragt, ob ich die Bilder löschen möchte. Danach kommt die Meldung “Killed”. Wenn ich mit --delte -n arbeite, dann kommt es ebenfalls zu dieser Meldung.

Der Aufruf über die Konsole funktionierte mal, als noch nicht so viele Bilder im Papierkorb waren.&nbsp;

Jemand eine Idee, wie ich den Papierkorn leer bekomme?

&nbsp;

Danke schon mal!

---

<div class="post-metadata">

**Author:** ![MarkusM1](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@MarkusM1](https://forum.shopware.com/u/MarkusM1)\
**Post date:** [12. April 2017 um 13:43 UTC](https://forum.shopware.com/t/media-papierkorb-uber-konsole-loschen/33000/8 "2017-04-12T13:43:20Z")

</div>

Ich hab auch ein Problem beim Löschen über diesen Weg…

Ich bekomme folgende Meldung:

```
/var/www/html# bin/console sw:media:cleanup -vvv --delete

                                                                                               
  [Doctrine\DBAL\DBALException]                                                                
  An exception occurred while executing 'INSERT INTO s_media_used                              
                      SELECT DISTINCT NULL, m.id                                               
                      FROM s_media m                                                           
                      INNER JOIN s_articles_img                                                
                          ON s_articles_img.media_id = m.id':                                  
  SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction  
                                                                                               

Exception trace:
 () at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:119
 Doctrine\DBAL\DBALException::driverExceptionDuringQuery() at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1027
 Doctrine\DBAL\Connection->exec() at /var/www/html/engine/Shopware/Bundle/MediaBundle/GarbageCollector.php:241
 Shopware\Bundle\MediaBundle\GarbageCollector->handleTable() at /var/www/html/engine/Shopware/Bundle/MediaBundle/GarbageCollector.php:139
 Shopware\Bundle\MediaBundle\GarbageCollector->find() at /var/www/html/engine/Shopware/Bundle/MediaBundle/GarbageCollector.php:83
 Shopware\Bundle\MediaBundle\GarbageCollector->run() at /var/www/html/engine/Shopware/Bundle/MediaBundle/Commands/MediaCleanupCommand.php:128
 Shopware\Bundle\MediaBundle\Commands\MediaCleanupCommand->handleMove() at /var/www/html/engine/Shopware/Bundle/MediaBundle/Commands/MediaCleanupCommand.php:61
 Shopware\Bundle\MediaBundle\Commands\MediaCleanupCommand->execute() at /var/www/html/vendor/symfony/console/Command/Command.php:259
 Symfony\Component\Console\Command\Command->run() at /var/www/html/vendor/symfony/console/Application.php:844
 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/engine/Shopware/Components/Console/Application.php:140
 Shopware\Components\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/console/Application.php:192
 Symfony\Component\Console\Application->doRun() at /var/www/html/engine/Shopware/Components/Console/Application.php:132
 Shopware\Components\Console\Application->doRun() at /var/www/html/vendor/symfony/console/Application.php:123
 Symfony\Component\Console\Application->run() at /var/www/html/bin/console:38

                                                                                               
  [PDOException]                                                                               
  SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction  
                                                                                               

Exception trace:
 () at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1025
 PDO->exec() at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1025
 Doctrine\DBAL\Connection->exec() at /var/www/html/engine/Shopware/Bundle/MediaBundle/GarbageCollector.php:241
 Shopware\Bundle\MediaBundle\GarbageCollector->handleTable() at /var/www/html/engine/Shopware/Bundle/MediaBundle/GarbageCollector.php:139
 Shopware\Bundle\MediaBundle\GarbageCollector->find() at /var/www/html/engine/Shopware/Bundle/MediaBundle/GarbageCollector.php:83
 Shopware\Bundle\MediaBundle\GarbageCollector->run() at /var/www/html/engine/Shopware/Bundle/MediaBundle/Commands/MediaCleanupCommand.php:128
 Shopware\Bundle\MediaBundle\Commands\MediaCleanupCommand->handleMove() at /var/www/html/engine/Shopware/Bundle/MediaBundle/Commands/MediaCleanupCommand.php:61
 Shopware\Bundle\MediaBundle\Commands\MediaCleanupCommand->execute() at /var/www/html/vendor/symfony/console/Command/Command.php:259
 Symfony\Component\Console\Command\Command->run() at /var/www/html/vendor/symfony/console/Application.php:844
 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/engine/Shopware/Components/Console/Application.php:140
 Shopware\Components\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/console/Application.php:192
 Symfony\Component\Console\Application->doRun() at /var/www/html/engine/Shopware/Components/Console/Application.php:132
 Shopware\Components\Console\Application->doRun() at /var/www/html/vendor/symfony/console/Application.php:123
 Symfony\Component\Console\Application->run() at /var/www/html/bin/console:38

sw:media:cleanup [--delete]

```

Was kann ich da machen?

---

<div class="post-metadata">

**Author:** ![dogado\_shops](https://avatars.discourse-cdn.com/v4/letter/d/b4bc9f/32.png) [@dogado\_shops](https://forum.shopware.com/u/dogado_shops)\
**Post date:** [12. April 2017 um 13:49 UTC](https://forum.shopware.com/t/media-papierkorb-uber-konsole-loschen/33000/9 "2017-04-12T13:49:00Z")

</div>

Hi,

falls Du einen eigenen Server mit root Zugriff hast:

> <https://magento.stackexchange.com/questions/90871/lock-wait-timeout-exceeded-try-restarting-transaction>

VG
