Sponsored Content
Top Forums Shell Programming and Scripting Traverse Directory Tree for backup Post 302088361 by reborg on Monday 11th of September 2006 06:16:05 PM
Old 09-11-2006
No duplicate thread or cross-posting - closed.
 

10 More Discussions You Might Find Interesting

1. Programming

Directory tree search???

Hi all, I've got a problem, what function do i use to list the contents of all the directory tree (simular to "find")? Any other suggestions? Thank you all (3 Replies)
Discussion started by: solvman
3 Replies

2. Programming

directory as tree

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

3. Shell Programming and Scripting

Searching directory tree

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)
Discussion started by: blane
7 Replies

4. Shell Programming and Scripting

directory tree

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

5. UNIX for Dummies Questions & Answers

Move all files in a directory tree to a signal directory?

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

6. Shell Programming and Scripting

Traverse through directory....

hi I have a directory structure like Parent Parent/child1/ Parent/child2/ Parent/child3/ and the each main directory contains Parent/child1/file1.txt, Parent/child1/fil2.zip ....... Parent/child2/file1.txt,Parent/child/fil2.zip ...... Now i want to traverse to each and want to... (1 Reply)
Discussion started by: Reddy482
1 Replies

7. UNIX for Dummies Questions & Answers

directory tree with directory size

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

8. Shell Programming and Scripting

How to traverse directory structure and sum size of files?

How do I write a bash or ruby or perl or groovy script to print all the files in my directory tree that are one-to-two years old, the size of each file, and the sum of file sizes and then delete them? I was using find . -atime +365 -exec rm '{}' \; but the problem was that I could not... (5 Replies)
Discussion started by: siegfried
5 Replies

9. Shell Programming and Scripting

Specific directory parsing in a directory tree

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

10. Shell Programming and Scripting

Traverse Latest directory First

I wish to traverse the latest to the oldest directory based on its timestamp. ls -ltr drwxr-x--- 3 admin bel 1024 Jan 22 02:29 sys drwxr-x--- 2 admin bel 2048 Jan 22 02:30 admin drwxr-x--- 10 admin bel 24576 Jan 23 21:31 bin For the above i need to cd first to... (2 Replies)
Discussion started by: mohtashims
2 Replies
dup2(2) 							System Calls Manual							   dup2(2)

NAME
dup2 - duplicate an open file descriptor to a specific slot SYNOPSIS
DESCRIPTION
fildes is a file descriptor obtained from a or system call. fildes2 is a non-negative integer less than the maximum value allowed for file descriptors. causes fildes2 to refer to the same file as fildes. If fildes2 refers to an already open file, the open file is closed first. The file descriptor returned by has the following in common with fildes: o Same open file (or pipe). o Same file pointer (that is, both file descriptors share one file pointer.) o Same access mode (read, write or read/write). o Same file status flags (see fcntl(2), The new file descriptor is set to remain open across system calls. See fcntl(2). This routine is found in the C library. Programs using but not using other routines from the Berkeley importability library (such as the routines described in bsdproc(3C)) should not give the option to ld(1). RETURN VALUE
Upon successful completion, returns the new file descriptor as a non-negative integer, fildes2. Otherwise, it returns -1 and sets to indi- cate the error. ERRORS
fails if the following is true: fildes is not a valid open file descriptor or fildes2 is not in the range of legal file descriptors. An attempt to close fildes2 was interrupted by a signal. The file is still open. WARNINGS
A multithreaded application or an application with a signal handler can exhibit a race between on one thread and another kernel call that assigns a new file descriptor while running on a second thread or signal handler. If fildes2 is free before the call was made, the other thread or signal handler may win the race and acquire that descriptor (e.g., in an call). The thread calling can then close this file and reuse the descriptor. This results in multiple functions improperly referring to the same file. This race can be avoided either by ensuring that fildes2 references an open file before calling or by providing user-level synchronization (or signal disabling) which makes sure that the thread and another thread or signal handler don't make competing calls into the kernel at the same time. SEE ALSO
close(2), creat(2), dup(2), exec(2), fcntl(2), open(2), pipe(2), privileges(5). STANDARDS CONFORMANCE
dup2(2)
All times are GMT -4. The time now is 04:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy