09-28-2001
I asked the question wrong
I need to check file by file from starting from / directroy, internally in C, not using outside command(ls, find, etc.) Let's say right my own ls. Is ther any function to list the contents of the directory or smth?
10 More Discussions You Might Find Interesting
1. Programming
hi i have modified a program to display directory entries recursively in a tree like form
i need an output with the following guidelines:
the prog displays the contents of the directory
the directory contents are sorted before printing so that directories come before regular files
if an entry... (2 Replies)
Discussion started by: anything2
2 Replies
2. Shell Programming and Scripting
Hi all,
The following is a script for displaying directory tree.
D=${1:-`pwd`}
(cd $D; pwd)
find $D -type d -print | sort |
sed -e "s,^$D,,"\
-e "/^$/d"\
-e "s,*/\(*\)$,\:-----\1,"\
-e "s,*/,: ,g" | more
exit 0
I am trying to understand the above script.But... (3 Replies)
Discussion started by: ravi raj kumar
3 Replies
3. UNIX for Dummies Questions & Answers
Hello, I am hoping someone maybe able to help me.
I have set up an Apache web server on my sun server with user accounts in the main htdocs directory. My question is how to stop these users searching up the directory tree when they ftp/telnet to the server. Also is it possible to restrict the... (2 Replies)
Discussion started by: rooneyl
2 Replies
4. UNIX for Dummies Questions & Answers
Is this possible? Let me know If I need specify further on what I am trying to do- I just want to spare you the boring details of my personal file management.
Thanks in advance-
Brian- (2 Replies)
Discussion started by: briandanielz
2 Replies
5. Shell Programming and Scripting
Hi all,
I'd like to create a directory tree, and define from stdin how many levels deep and how many directories in each level should be created.
What I wrote does not work properly:#!/bin/bash
#set -x
read -p " What root directory? " rootDir
&& { /bin/rm -R $rootDir; mkdir $rootDir; } ||... (2 Replies)
Discussion started by: NBaH
2 Replies
6. UNIX for Dummies Questions & Answers
find . -type d -print 2>/dev/null|awk '!/\.$/ {for (i=1;i<NF;i++){d=length($i);if ( d < 5 && i != 1 )d=5;printf("%"d"s","|")}print "---"$NF}' FS='/'
Can someone explain how this works..??
How can i add directory size to be listed in the above command's output..?? (1 Reply)
Discussion started by: vikram3.r
1 Replies
7. Programming
I am writing code for a binary search tree search and when I compile it i am getting strange errors such as, " /tmp/ccJ4X8Xu.o: In function `btree::btree()':
project1.cpp:(.text+0x0): multiple definition of `btree::btree()' "
What does that mean exactly?
tree.h
#ifndef TREE_H
#define... (1 Reply)
Discussion started by: meredith1990
1 Replies
8. Shell Programming and Scripting
Hi friends,
Hello again :)
i got stuck in problem. Is there any way to get a special directory from directory tree?
Here is my problm.." Suppose i have one fix directory structure "/abc/xyz/pqr/"(this will be fix).Under this directory structure i have some other directory and... (6 Replies)
Discussion started by: harpal singh
6 Replies
9. Programming
I have some questions about certain placement of child nodes since I'm just learning BSTs and it's quite confusing even after reading some sources and doing some online insertion applets. Let's say I want to add nodes 5,7,3,4 to an empty basic BST.
... (1 Reply)
Discussion started by: Jill Ceke
1 Replies
10. UNIX for Dummies Questions & Answers
Hello Everyone,
I need to find the file / directory with the maximum timestamp in a directory tree having many files / directories.
Could you please help.
Thanks,
H squared (3 Replies)
Discussion started by: H squared
3 Replies
LEARN ABOUT OSX
git-ls-tree
GIT-LS-TREE(1) Git Manual GIT-LS-TREE(1)
NAME
git-ls-tree - List the contents of a tree object
SYNOPSIS
git ls-tree [-d] [-r] [-t] [-l] [-z]
[--name-only] [--name-status] [--full-name] [--full-tree] [--abbrev[=<n>]]
<tree-ish> [<path>...]
DESCRIPTION
Lists the contents of a given tree object, like what "/bin/ls -a" does in the current working directory. Note that:
o the behaviour is slightly different from that of "/bin/ls" in that the <path> denotes just a list of patterns to match, e.g. so
specifying directory name (without -r) will behave differently, and order of the arguments does not matter.
o the behaviour is similar to that of "/bin/ls" in that the <path> is taken as relative to the current working directory. E.g. when you
are in a directory sub that has a directory dir, you can run git ls-tree -r HEAD dir to list the contents of the tree (that is sub/dir
in HEAD). You don't want to give a tree that is not at the root level (e.g. git ls-tree -r HEAD:sub dir) in this case, as that would
result in asking for sub/sub/dir in the HEAD commit. However, the current working directory can be ignored by passing --full-tree
option.
OPTIONS
<tree-ish>
Id of a tree-ish.
-d
Show only the named tree entry itself, not its children.
-r
Recurse into sub-trees.
-t
Show tree entries even when going to recurse them. Has no effect if -r was not passed. -d implies -t.
-l, --long
Show object size of blob (file) entries.
-z
line termination on output and do not quote filenames. See OUTPUT FORMAT below for more information.
--name-only, --name-status
List only filenames (instead of the "long" output), one per line.
--abbrev[=<n>]
Instead of showing the full 40-byte hexadecimal object lines, show only a partial prefix. Non default number of digits can be specified
with --abbrev=<n>.
--full-name
Instead of showing the path names relative to the current working directory, show the full path names.
--full-tree
Do not limit the listing to the current working directory. Implies --full-name.
[<path>...]
When paths are given, show them (note that this isn't really raw pathnames, but rather a list of patterns to match). Otherwise
implicitly uses the root level of the tree as the sole path argument.
OUTPUT FORMAT
<mode> SP <type> SP <object> TAB <file>
This output format is compatible with what --index-info --stdin of git update-index expects.
When the -l option is used, format changes to
<mode> SP <type> SP <object> SP <object size> TAB <file>
Object size identified by <object> is given in bytes, and right-justified with minimum width of 7 characters. Object size is given only for
blobs (file) entries; for other entries - character is used in place of size.
Without the -z option, pathnames with "unusual" characters are quoted as explained for the configuration variable core.quotePath (see git-
config(1)). Using -z the filename is output verbatim and the line is terminated by a NUL byte.
GIT
Part of the git(1) suite
Git 2.17.1 10/05/2018 GIT-LS-TREE(1)