Avatar of ipjyo
ipjyoFlag for United States of America

asked on 

How to delete particular files in a directory?

Hi,

I have two types of files in a directory as below. Both of them are text files but distinguished by the name prefix "PST" or "SEQ".

PST-051311, PST-051211 etc
SEQ-051311, SEQ-051211, SEQ-051011 etc

I need to look at the directory and for each of those files that start with SEQ, get the date part after the hyphen and if there is no PST file with the same date after the hyphen then delete the SEQ file. In the above example, the file SEQ-051011 should be deleted.

I am looking for some ideas how to do this? Thanks for any ideas.

C#.NET Programming

Avatar of undefined
Last Comment
ipjyo
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of morgulo
morgulo
Flag of Poland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of ipjyo
ipjyo
Flag of United States of America image

ASKER

Thank you very much guys. This is what exactly I need to do in my code.
Both the solutions are working great.
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo