 Hey guys, welcome to ssvitec.com and today we are going to see another area of internal question and answer like how we can delete the files those are having the size more than 1MB from the blog stories. So we want to delete all those files those are having 1MB or more than that in the size. So how we can do that? So let me quickly go into the Azure Blog Stories. And here as we can see under this testing folder we have these two files. So as per the size currently we don't have as much large file. So we are going to implement the logic on these two files. So we will be going to delete the file those are having the size more than 250 bytes. So that we can see in the first one. In the second one that is 198 bytes so we are not going to delete this file from this blog stories. So only first we will be deleted. So let me quickly go into the Azure Data Factory and we will try to implement this in practical. So let me try to add a new pipeline here. Now here what we want to do? So first we have to use a getMetadataActivity. So under the getMetadataActivity we will be using the child items. So that will be containing all the files those are available under the testing folder. Second we will be going to use the forEachActivity. So we will loop through all these files one by one. Next under the forEachLoopActivity we will be going to use another getMetadataActivity for checking the size of the file. So we will get the size of the file from the another getMetadataActivity under the forEachActivity. And after that we will be use the ifConditionActivity whether we will be checking the size of the file is greater than 250 bytes or not. If that is then we will be going to delete that. So this is the flow that we have to implement. So here let me try to use the getMetadataActivity first. So this getMetadataActivity will be used to get all these files those are available under the testing folder. So first we have to go under the settings and trying to add a new data set here and this data set will be going to pointing the testing folder. So we can browse here and we can select the testing folder. So here after selecting this we are not required to select any of these files. So it will be keeping the file those are available under the testing folder. So as of now we can see only these two files. Now here we can see the field list. So what property we want to use? We want to use the child items of the getMetadataActivity. So child items will be keeping all these files. So let me click on this plus symbol on the new and here in the argument we can select the child items. Now we can use the forage activity and this forage activity will be looped through for all these files one by one and will be processing. So under the setting under the items we can select the child item from the getMetadataActivity one. Now we can go under this forage activity and in this forage activity we will be going to use the getMetadataActivity again. So this getMetadataActivity will get the file name along with the size of the file. So again here we have to create the data set and this data set will be dynamic like the file names we are getting from the forage activity. So the file name will be dynamic. So let me click on continue and here we can select this link service. Here let me try to browse and select the testing folder and click on OK. First row as header we can mark this and click on OK. So go here and here let me try to open this. So under this we can mark this as dynamic like the file name. So for making this as dynamic we can go into the parameter and try to add a new parameter here. So this is the file name and in the connection we can select this file name parameter that we have created. So once we made this change in the pipeline level it is asking the file name value. So this file name value is coming from this forage activity and we can use the name property of this. Click on OK. So it will be having the getMetadataActivity we have set up the data set here which field list we want to use here. So we want to get the file name so that will be the item name. Second we are also required to see the size. So here we can see the size. So once we have set up this let me try to execute and we will try to validate. In this getMetadataActivity2 we will be having the file name along with the size of the file or not. So this is in progress we have to wait. So in the getMetadataActivity1 it will be having total two files. So as we can see the first file and the second file. And after that we can see the forage activity. So this forage activity will be going to execute two times. So that we can see here the count as in two. Now we can see the getMetadata2. So here we can check the file name along with the size. So size is coming in the bytes. So we can compare along with the bytes directly. Let me cancel this go back to here. After this getMetadataActivity we are required to use the ifConditionActivity. So what we are doing now whatever the size we are getting from this getMetadata2. If that size is greater than 250 bytes then we will be deleting those. So under the ifConditionActivity we can go in the activities and under the expression we can specify. So the expression is we are required to check the greater value of 250 from the getMetadataActivity2 and the property will be the size. So we can select that. So if this value is greater than 250 bytes then it will return true otherwise it will return false. So click on OK. So if that will true then we are required to delete the file. So let me try to drag and drop this delete and here let me try to go in the source and required to set up a dataset. So let me quickly set up the dataset here again. So we can select the link service and here we can select the path. So again we are going to select till testing and the file name will be making as dynamic. So click on OK. Let me try to open this and here we can see the parameter. So let me try to add the file name here and go to the connection and here the file name is coming from this FName parameter click on OK. Once we have make this change then pipeline level we can go and this dataset is asking about the file name. So the file name that should be coming from the getMetadataActivity2 and the property which is the item name. Now click on OK. So once we have set up this so everything looks good. We can go into the pipeline and try to execute it. So it is asking in the logging level if you want to enable logging on the delete activity then we have to set up the link service. So I am not going to enable the logging for this. So now let me try to execute it. So once it will be executed one file will be deleted and second file will be there and the file which is more than 250 bytes should be deleted. So as you can see the first file which is the salesindia.json will be deleted from here and salesuk.json will not be deleted because the size which is less than 250 bytes. So here we can see everything is executed successfully. Here the first if condition is checking for the first file and it will succeed. So under the true we can see the delete activity which is deleting the file and in the second time it is again checking for the second file and it does not find the value as true. So that is why delete activity did not executed. Let me go here try to refresh. So one file should be deleted and one is remaining as you can see here. So this is very common interview question. So thank you so much for watching this video. I would request all of you please like this video and subscribe our channel. See you in the next video.