Sponsored Content
Top Forums Programming opendir() + customly created directories Post 302179078 by shamrock on Thursday 27th of March 2008 12:55:49 AM
Old 03-27-2008
opendir() returns a pointer to a dir stream. readdir() is invoked in a loop afterwards to read the contents of the opened dir stream. Each dir entry is passed from readdir() to stat() which stores information in a stat structure. The S_ISDIR() macro can be used to test whether the stat structure is a dir or not. Look at the manpages of opendir() readdir() and stat().
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

PHP 5 solaris opendir failure

Hello! I've moved a web from my RHEL5 Apache/2.2.3 machine to a Sun Solaris 5.9 Apache/2.2.6 (Unix) PHP/5.2.5 mod_ssl/2.2.6 machine. The web worked just fine on the rhel5 machine and most of the php pages works fine on the solaris machine to but not the one where I read a directory and prints... (1 Reply)
Discussion started by: Esaia
1 Replies

2. Shell Programming and Scripting

Script for parsing directories one level and finding directories older than n days

Hello all, Here's the deal...I have one directory with many subdirs and files. What I want to find out is who is keeping old files and directories...say files and dirs that they didn't use since a number of n days, only one level under the initial dir. Output to a file. A script for... (5 Replies)
Discussion started by: ejianu
5 Replies

3. UNIX for Dummies Questions & Answers

home directories not being created by useradd

greetings. I'm using debian lenny, bash shell environment. It is my understanding that by default, the useradd command should create subdirectories under the /home directory, with the same name as the user being created, but this is not happening. I checked useradd -D and it showed, among... (2 Replies)
Discussion started by: fguy
2 Replies

4. Shell Programming and Scripting

Find directories only and delete them created 3 days before

Hello I have some directories and files created under /export/local/user I would like to delete directories only under /export/local/user, created before 3 days Can someone help me with command to do this task? Thanks (4 Replies)
Discussion started by: needyourhelp10
4 Replies

5. Shell Programming and Scripting

Help in writing the scirpt for grepping on patterns in the directories created previous day

Hi, I have a challenging requiremant to be done in one day:( there is directory in which a new directory gets created per hour i.e 24 directories per a day like below. Dec 01 00:04 2011.12.12-23 Dec 01 01:11 2011.12.10-07 Dec 01 01:11 2011.12.10-08 Dec 01 01:11 2011.12.10-09 Dec 01... (2 Replies)
Discussion started by: mahesh Madpathi
2 Replies

6. Programming

Opendir

code: #include<iostream> #include <dirent.h> using namespace std; int main() { DIR*dir; dir = opendir("/"); if (dir !=NULL) { struct dirent * abcd; while ((abcd=readdir (dir))!=NULL) { cout << abcd -> d_name; } }} output : this gives the output of Directory "/" ques : (1 Reply)
Discussion started by: console
1 Replies

7. Homework & Coursework Questions

Opendir

code: #include<iostream> #include <dirent.h> using namespace std; int main() { DIR*dir; dir = opendir("/"); if (dir !=NULL) { struct dirent * abcd; while ((abcd=readdir (dir))!=NULL) { cout << abcd -> d_name; } }} output : this gives the output of Directory "/" ques : (1 Reply)
Discussion started by: console
1 Replies

8. Solaris

Giving read write permission to user for specific directories and sub directories.

I have searched this quite a long time but couldn't find the right method for me to use. I need to assign read write permission to the user for specific directories and it's sub directories and files. I do not want to use ACL. This is for Solaris. Please help. (1 Reply)
Discussion started by: blinkingdan
1 Replies

9. Shell Programming and Scripting

Shell script to check current date file is created and with >0 kb or not for multiple directories

Hi All, I am new in scripting and working in a project where we have RSyslog servers over CentOS v7 and more than 200 network devices are sending logs to each RSyslog servers. For each network devices individual folders create on the name of the each network devices IP addresses.The main... (7 Replies)
Discussion started by: Pinaki
7 Replies
chooseDirectory(3)					User Contributed Perl Documentation					chooseDirectory(3)

NAME
chooseDirectory - pops up a dialog box for the user to select a directory. SYNOPSIS
$widget->chooseDirectory( ?option value ...? ); DESCRIPTION
The method chooseDirectory is implemented as a perl wrapper on the core tk "command" tk_chooseDirectory, and $widget is passed as the argument to the hidden -parent option. The chooseDirectory method pops up a dialog box for the user to select a directory. The following option-value pairs are possible as command line arguments: -initialdir dirname Specifies that the directories in directory should be displayed when the dialog pops up. If this parameter is not specified, then the directories in the current working directory are displayed. If the parameter specifies a relative path, the return value will convert the relative path to an absolute path. This option may not always work on the Macintosh. This is not a bug. Rather, the General Controls control panel on the Mac allows the end user to override the application default directory. -parent $widget Makes $widget the logical parent of the dialog. The dialog is displayed on top of its parent window. -title titleString Specifies a string to display as the title of the dialog box. If this option is not specified, then a default title will be displayed. -mustexist boolean Specifies whether the user may specify non-existant directories. If this parameter is true, then the user may only select directories that already exist. The default value is false. CAVEATS
Perl does not have a concept of encoded filesystems yet. This means that operations on filenames like "opendir" and "open" still use byte semantics. Tk however uses character semantics internally, which means that you can get filenames with the UTF-8 flag set in functions like "chooseDirectory", "getOpenFile" and similar. It's the user's responsibility to determine the encoding of the underlying filesystem and convert the result into bytes, e.g. use Encode; ... my $dir = $mw->chooseDirectory; $dir = encode("windows-1252", $dir); opendir DIR, $dir or die $!; ... See also "When Unicode Does Not Happen" in perlunicode and "Unicode in Filenames" in perltodo. SEE ALSO
Tk::getOpenFile, Tk::getOpenFile KEYWORDS
directory selection dialog perl v5.12.1 2007-11-08 chooseDirectory(3)
All times are GMT -4. The time now is 03:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy