Hi, According to my logic I need to accomplish in this script(Logic: My perl script should check for a certain column(column name STATUS) in a table(table name INFO). If the status column is equal to 'I OR D' it has to look at the data in the" ID ,number column", remember that ID and number and then go to the location "c:\Documents and Settings\user\Files and delete the directories that are named by this ID.).

I was able to connect to oracle and select the required columns and print them, but need help from here. How to remember the data in the "ID " column and go to the location " c:\Documents and Settings\user\Files" and delete these directories.

Current Script: #!/usr/perl/5.8.8/bin/perl -w use strict; use DBI; my $db = DBI->connect( "dbi:Oracle:*****", "*****", "******" ) || die( $DBI::errstr . "\n" ); $db->{AutoCommit} = 0; $db->{RaiseError} = 1; $db->{ora_check_sql} = 0; $db->{RowCacheSize} = 16; my $SEL = "SELECT number,id,status FROM info where status in ('I,D')" +; my $sth = $db->prepare($SEL); $sth->execute(); while ( my @row = $sth->fetchrow_array() ) { foreach (@row) { $_ = "\t" if !defined($_); print "$_\t"; } print "\n"; } END { $db->disconnect if defined($db); } current output: number Id status HDF0008 89456R I HDF0009 34567R D Files: c:\Documents and Settings\user\Files HDF0009 -> 34567R -> folder1 , folder2 .... HDF0008 -> 89456R -> folder1 , folder2.... DIR -> Subdirectory -> older1 , folder2....

In reply to Deleting Directories from a path by reading information from Database columns by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.