opendir C, "C:\\"; @C_DIR = (readdir(C)); closedir C; open(Ctxt_files, ">full system memory\\C_DRIVE_FILES.txt"); open(Ctxt_dirs, ">full system memory\\C_DRIVE_DIRS.txt"); foreach $C_FILE (@C_DIR) { if (-f "C:/$C_FILE") { print Ctxt_files "$C_FILE\n"; } elsif( -d "C:/$C_FILE") { print Ctxt_dirs "$C_FILE\n"; } } close(Ctxt_files); close(Ctxt_dirs);