That works great!
I need to use this in a Perl script, where I store the ls -iR output in a file and parse that file. If the line contains a directory, store it in a variable. If its a file name and inode, and if the inode is the same as some predefined value, then I need to use the inode and the dir_name. I have the code below, and obviously it doesnt work. Any idea why?
Thanks!
system "ls -iR > temp_inodes_fnames";
open(INO_FNAME, "temp_inodes_fnames") || die "File doesnt exist!";
open(FNAMES, ">>temp_filenames") || die "File doesnt exist!" ;
while($record = <INO_FNAME>){
if($record =~ m/^\ /i
$dir_name = $record;
($inode,$fname) = split (' ', $record);
if ( $inode == $my_inode) {
print ($inode, "\t", $fname, "\t", $dir_name, "\n");
}
}
close(INO_FNAME);
close(FNAMES);