<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Deleting multiple promotion packages with CLI? in Administration and Deployment</title>
    <link>https://communities.sas.com/t5/Administration-and-Deployment/Deleting-multiple-promotion-packages-with-CLI/m-p/730089#M21880</link>
    <description>The sas-admin transfer delete command only accepts one ID or URI at a time, so if you had multiple packages you would need to run each separately.</description>
    <pubDate>Tue, 30 Mar 2021 13:44:43 GMT</pubDate>
    <dc:creator>gwootton</dc:creator>
    <dc:date>2021-03-30T13:44:43Z</dc:date>
    <item>
      <title>Deleting multiple promotion packages with CLI?</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Deleting-multiple-promotion-packages-with-CLI/m-p/730077#M21878</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using this command to delete promotion packages in Viya 3.4.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sas-admin transfer delete --id 15340677-581a-4635-b548-4df207226714&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to simultaneously delete multiple packages? Does anyone know if this is this possible with this command or do I need to write a script for this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Richard&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 12:55:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Deleting-multiple-promotion-packages-with-CLI/m-p/730077#M21878</guid>
      <dc:creator>RichardP</dc:creator>
      <dc:date>2021-03-30T12:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting multiple promotion packages with CLI?</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Deleting-multiple-promotion-packages-with-CLI/m-p/730089#M21880</link>
      <description>The sas-admin transfer delete command only accepts one ID or URI at a time, so if you had multiple packages you would need to run each separately.</description>
      <pubDate>Tue, 30 Mar 2021 13:44:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Deleting-multiple-promotion-packages-with-CLI/m-p/730089#M21880</guid>
      <dc:creator>gwootton</dc:creator>
      <dc:date>2021-03-30T13:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting multiple promotion packages with CLI?</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Deleting-multiple-promotion-packages-with-CLI/m-p/866494#M26330</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/274763"&gt;@RichardP&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I struggled with the same issue and came up with this script that seems to work. Please take care before using it and make sure you have a backup.&lt;/P&gt;
&lt;P&gt;Note that you can replace the&amp;nbsp;&lt;STRONG&gt;jq '.items[].id'&lt;/STRONG&gt; with&amp;nbsp;&lt;STRONG&gt;jq '.items[0].id'&lt;/STRONG&gt; to test deleting only the first package instead of all packages at once.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The script assumes that you created a profile+authenticated with "sas-admin" prior to running this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;PRE&gt;#!/bin/bash

echo "List of packages to be deleted:"
/opt/sas/viya/home/bin/sas-admin transfer list

echo "Proceed with delete? (Y/n)"
read vproceed

if [[ "$vproceed" == "Y"]]; then
    echo "Deleting packages..."
    for i in $(/opt/sas/viya/home/bin/sas-admin --output json transfer list | jq '.items[].id' | sed 's/\"//g') 
    do
        yes | /opt/sas/viya/home/bin/sas-admin transfer delete --id $i
    done
else
    echo "Exiting without deleting packages..."
fi&lt;/PRE&gt;
&lt;P&gt;Eyal&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 12:19:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Deleting-multiple-promotion-packages-with-CLI/m-p/866494#M26330</guid>
      <dc:creator>EyalGonen</dc:creator>
      <dc:date>2023-03-27T12:19:10Z</dc:date>
    </item>
  </channel>
</rss>

