Re: file deletion in a directory with some conditions .
- From: santosh <santosh.k83@xxxxxxxxx>
- Date: Thu, 31 Jul 2008 23:52:53 +0530
Ajay wrote:
On Jul 31, 6:10 am, santosh <santosh....@xxxxxxxxx> wrote:
aki wrote:
Hi All,
I describe the problem as below.
A directory( path known) , contains 0 to any number of files .
The file names are with following structure :
OMCID_NETYPE_NENAME_NAMEOFTHEAPPLIEDFILE_APPLYDATE_trans.csv
For example :
4_TC_TC_48_NoSTConfiguration_1971-1-1_trans.csv
where
OMCID =4
NETYPE= TC
NENAME= TC_48
NAMEOFTHEAPPLIEDFILE=NoSTConfiguration
APPLYDATE=1971-1-1
i have to perform delete operation on the file with matching three
fields .
OMCID , NETYPE, NENAME (All three known )
Could somebody try to answer the problem . or tel how to proceed
[ ... ]
Adding to what Santosh told:
If you are on a Linux box and use are using Libc4 or Libc5, you can
use functions scandir() and alphasort()
to obtain directory listing. you need to look for header files
dirent.h
I am not sure about its portability to other systems :(
They are not very portable at all. They are also deprecated by at least
one standard. A more portable solution is to use
opendir/readdir/closedir along with the facilities defined in regex.h.
All of these are standardised by POSIX and hence fairly portable.
For further discussions of these functions the OP should consider
posting on comp.unix.programmer, where there is a higher likelyhood of
receiving better, more accurate, peer reviewed answers, as there are
far more active Unix/POSIX experts there than here.
<snip>
.
- References:
- Prev by Date: Re: file deletion in a directory with some conditions .
- Next by Date: Re: Procyon Library for Atmel AVR MCU - I²C problems
- Previous by thread: Re: file deletion in a directory with some conditions .
- Next by thread: Doubt
- Index(es):
Relevant Pages
|