Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi I have a folder containing many files , is there a way if i can just filter out or delete the files (which are

Hi I have a folder containing many files , is there a way if i can just filter out or delete the files (which are not in the list) according to a list of Strings which is a substring of the file names.

List of String,

List fileListNames = Arrays.asList("bus_ticket","driver_trips","train_ticket");

the filenames inside the folder are like this

ABC_bus_device_20230118_20230119.xml

ABC_bus_ticket_20230118_20230119.xml

AET_driver_trips_20230118_20230119.xml

I only want this two files in the folder

ABC_bus_ticket_20230118_20230119.xml

AET_driver_trips_20230118_20230119.xml

Is there a filter out using Java code, please help thanks

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Outlook 2023

Authors: James Holler

1st Edition

B0BP9P1VWJ, 979-8367217322

More Books

Students also viewed these Databases questions