I have a directory /var/spool
and inside that, directories named
a b c d e f g h i j k l m n o p q r s t u v x y z
And inside each "letter directory", a directory called "user
" and inside this, many directories called auser1
auser2
auser3
auser4
auser5
...
Every user directory contains mail messages and the file names have the following format: 2. 3. 4. 5. etc.
How can I list the email files for every user in every directory in the following way:
/var/spool/a/user/auser1/11. /var/spool/a/user/auser1/9. /var/spool/a/user/auser1/8. /var/spool/a/user/auser1/10. /var/spool/a/user/auser1/2. /var/spool/a/user/auser1/4. /var/spool/a/user/auser1/12. /var/spool/b/user/buser1/12. /var/spool/b/user/buser1/134. /var/spool/b/user/buser1/144.
etc.
I need that files and then open every single file for modify the header and body. This part I already have, but I need the first part.
I am trying this:
dir = "/var/spool";
opendir ( DIR, $dir ) || die "No pude abrir el directorio $dirname\n";
while( ($filename = readdir(DIR))){
@directorios1 = `ls -l "$dir/$filename"`;
print("@directorios1\n");
}
closedir(DIR);
But does not work the way I need it.