When cooking something recursive I think there are two essential ingredients:
local variables ( "typeset var" )
variable passing
There are multiple functions active at the same time and their variables should not interfere with parent's variables. To make a distinction between local and global variables I used lower case and upper case. Also there was a while loop in the generate function that should be an if statement.
---------- Post updated at 11:10 PM ---------- Previous update was at 10:33 PM ----------
Also, if you move the creation of the topdir at each level to the function, you can make it a bit shorter:
I almost have the entire script written. however the problem is how would i assign the global variable to terminate the process from the bottom up to ensure the child terminates so the parent can.
ex. I am proccess 1
I am proccess 2
etc
Here is the code
$ cat tree.c
... (3 Replies)
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)
I'm currently trying to write a script that will do the following:
search a given directory tree for a file with MMDDYYYY in the name.
delete those files only.
I can't figure out how to make the script delete the files with the MMDDYYYY in the filename after finding them.
Should I export... (7 Replies)
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)
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)
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)
Hi Experts,
I have table in mysql like below:
'user` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`parent_id`
varchar(100) NOT NULL,
`member_name` varchar(100) NOT NULL,
`city` varchar(100) NOT NULL,
`member_id` varchar(100) NOT
NULL,
`password` varchar(100) NOT... (1 Reply)
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)
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 OPENDARWIN
mkzftree
MKZFTREE(1) H. Peter Anvin MKZFTREE(1)NAME
mkzftree - Create a zisofs/RockRidge compressed file tree
SYNOPSIS
mkzftree [OPTIONS]... INPUT OUTPUT
DESCRIPTION
Takes an input file tree (INPUT) and create a corresponding compressed file tree (OUTPUT) that can be used with an appropriately patched
mkisofs(8) to create a transparent-compression ISO 9660/Rock Ridge filesystem using the "ZF" compression records.
OPTIONS -f, --force
Always compress all files, even if they get larger when compressed.
-z level, --level level
Select compression level (1-9, default is 9). Lower compression levels are faster, but typically result in larger output.
-u, --uncompress
Uncompress an already compressed tree. This can be used to read a compressed filesystem on a system which cannot read them
natively.
-p parallelism, --parallelism parallelism
Compress in parallel. The parallelism value indicates how many compression threads are allowed to run.
-x, --one-filesystem
Do not cross filesystem boundaries, but create directory stubs at mount points.
-X, --strict-one-filesystem
Do not cross filesystem boundaries, and do not create directory stubs at mount points.
-C path, --crib-path path
Steal ("crib") files from another directory if it looks (based on name, size, type and modification time) like they match entries in
the new filesystem. The "crib tree" is usually the compressed version of an older version of the same workload; this thus allows
for "incremental rebuilds" of a compressed filesystem tree. The files are hardlinked from the crib tree to the output tree, so if
it is desirable to keep the link count correct the crib path should be deleted before running mkisofs. The crib tree must be on the
same filesystem as the output tree.
-l, --local
Do not recurse into subdirectories, but create the directories themselves.
-L, --strict-local
Do not recurse into subdirectories, and do not create directories.
-F, --file
Indicates that INPUT may not necessarily be a directory; this allows operation on a single file. Note especially that if -F is
specified, and INPUT is a symlink, the symlink itself will be copied rather than whatever it happens to point to.
-s, --sloppy
Treat file modes, times and ownership data as less than precious information and don't abort if they cannot be set. This may be
useful if running mkisofs on an input tree you do not own.
-v, --verbose
Increase the program verbosity.
-V value, --verbosity value
Set the program verbosity to value.
-q, --quiet
Issue no messages whatsoever, including error messages. This is the same as specifying -V 0.
-h, --help
Display a brief help message.
-w, --version
Display the release version.
BUGS
Long options (beginning with --) may not work on all systems. See the message printed out by mkzftree -h to see if this applies to your
system.
Inode change times (ctimes) are not copied. This is a system limitation and applies to all file copy programs.
If using the parallel option (-z) the access times (atimes) on directories may or may not be copied. If it is important that the atimes on
directories are copied exactly, avoid using -z.
AUTHOR
Written by H. Peter Anvin <hpa@zytor.com>.
COPYRIGHT
Copyright (C) 2001-2002 H. Peter Anvin.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU-
LAR PURPOSE.
SEE ALSO mkisofs(8)zisofs-tools 30 July 2001 MKZFTREE(1)