Delete a single file from multiple files

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Delete a single file from multiple files

L0 Member

I have created a sub-playbook(which is running in a loop for multiple inputs) generating multiple files json's and csv's. I want to delete json's only and keep csv's for a single run and at the end of loop, I want only csv's.

How can I do that?

I have tried delete context and in "Key" field I am passing entry ID of the file but I am getting error i.e  ID is restricted for Incident

and you are not invited.

I have the administrator level access.

1 REPLY 1

L3 Networker

Hi,
The key argument of the command DeleteContext is expecting the context key name of what you want to delete,
providing "File" will result with all files being deleted, you can use index=0 argument as well to delete only the first file for example,
but to achieve what you want to do this command won't be enough.
What I find as the best solution so far is to simply reset the File context key only with the files you wish to maintain, overwriting those you don't want;
You'll need to run the "Set" command, with a key argument of "File", for its value argument you will need to use the Filters & Transformers;
1. Get = File
2. Filter = File.Extension "Equals" csv

This way the File context key will be recreated, only with csv files,
thanks.

  • 2165 Views
  • 1 replies
  • 1 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!