Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete all apps that match a filter

Is there a quick way to do something like:

cf delete *-failed

To delete all applications ending with -failed ?

like image 233
Quentin Herzig Avatar asked Sep 04 '18 07:09

Quentin Herzig


People also ask

Should I uninstall apps I don't use?

Even though some pre-installed apps can be useful, you should uninstall the ones you don't use. Note that different Android skins have different amounts of bloatware; some are lighter, such as OxygenOS and Pixel UI, while others are heavier, like One UI and MIUI.

What apps do I not use?

You should see a list containing all of the apps installed on your device. If you just want to view the ones you never use, tap the small gray arrow near the top right-hand corner. This will give you a drop-down menu in which you can choose "Never used apps."

How do I uninstall PCF app?

To delete an app with no services, run cf delete -r APP-NAME . Replace APP-NAME with the name of the app. The -r option instructs the cf CLI to removes routes associated with the app. If you delete an app without the r option, you can delete the route manually.


2 Answers

If you're on Linux/Unix/Cygwin, you can do this:

cf apps | tail +5 | cut -d ' ' -f 1 | grep "my-filter" | xargs -n 1 cf delete -f

The first will get a list of apps, the second will strip off the headers that the cf cli writes, the third cuts out just the app names and the fourth filters and the fifth will run cf delete -f for each app it finds.

There are tons of variations on this, to filter and grab only the information you want.

like image 130
Daniel Mikusa Avatar answered Oct 03 '22 19:10

Daniel Mikusa


Write a shell-script or Powershell script (Wrapper scripts) that execute this command

cf apps

and read the response that is given back.. You will get all the app-names . Read that list recursively and Match the pattern for app-names ending with -failed and then execute delete-command

cf delete APP_NAME

like image 27
Arun Avatar answered Oct 03 '22 18:10

Arun