Sponsored Content
Top Forums Shell Programming and Scripting Traverse Latest directory First Post 302885231 by alister on Friday 24th of January 2014 09:21:35 AM
Old 01-24-2014
Don't reverse the sort. Don't use the long format. If any pathname contains whitespace or a shell metacharacter, use a while-read loop instead of a for.

Regards,
Alister
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Traverse Directory Tree for backup

Hi, I am trying to write a script that will move all the files from source directory structure(multiple levels might exist) to destination directory structure. If a sub directory in source doesnot exist in destination then I have to skip and goto next level. I also need to delete the files in... (1 Reply)
Discussion started by: srmadab
1 Replies

2. Shell Programming and Scripting

Get the latest directory created

hi, I need to get the latest directory created for example wheni run ls -altr *xyz_Integration* I have plenty of directories created like my_build_77_xx_Integration_050908_150714: total 177898 -rw-rw--- 1 xyzmgr cchyg 7687338 May 9 19:29 myapp.ear ... (2 Replies)
Discussion started by: f354676
2 Replies

3. UNIX for Dummies Questions & Answers

pick the very latest directory

Hi, I have some list of directories in the form datemonthyear e.g. 02082009, 03082009 and 04082009 etc. I need to pick the latest directory from the current working directory. Outcome: 05082009 This is the output am expecting. Thanks (6 Replies)
Discussion started by: venkatesht
6 Replies

4. Shell Programming and Scripting

Copy the latest file from one directory to another

Hi All, I am in the directory a/b/processed the files in this directories are -rw-r--r-- 1 owb users 330 Aug 8 chandantest.txt_08082008 -rw-r--r-- 1 owb users 220 Aug 7 chandantest.txt_07082008 -rw-r--r-- 1 owb users 330 Aug 6... (3 Replies)
Discussion started by: chandancsc
3 Replies

5. Shell Programming and Scripting

Copy the latest file to a directory

Hi Team, I wish to copy the latest file of pattern "MyFile*" to some other location. I need to do all the operation in a single command separated by |. ls -rt <MyFile*> | tail -1 | <copy command>. How can I do? Please help me. Thanks, Kanda (2 Replies)
Discussion started by: spkandy
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. Shell Programming and Scripting

Move the latest or older File from one directory to another Directory

I Need help for one requirement, I want to move the latest/Older file in the folder to another file. File have the datetimestamp in postfix. Example: Source Directory : \a destination Directory : \a\b File1 : xy_MMDDYYYYHHMM.txt (xy_032120101456.txt) File2: xy_MMDDYYYYHHMM.txt... (1 Reply)
Discussion started by: pp_ayyanar
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

How to retrieve the latest files from the directory.?

hi, i have some file in a directory say p1.txt.201305051200.lst p1.txt.201305051300.lst p1.txt.201306051200.lst p1.txt.201306051300.lst p2.txt.201306051200.lst p2.txt.201306051300.lst i am using p* pattern to retrieve these file ls -1 p* the files in red color are the latest... (7 Replies)
Discussion started by: Little
7 Replies

10. UNIX for Dummies Questions & Answers

Remove all the subdirectories except latest 5 inside any given directory

I Want to remove all the sub-directories except latest five in any given TGTDIR. Is there a way to do so without making a cd to TGTDIR? I have tried the following but not worked. Thank you. rm -rf `ls -t $TGTDIR | awk 'NR>5'` (20 Replies)
Discussion started by: Devendra Hupri
20 Replies
TDB_OPEN(3)						     Linux Programmer's Manual						       TDB_OPEN(3)

NAME
tdb_open - Open a tdb database. SYNOPSIS
#include <tdb.h> TDB_CONTEXT *tdb_open(const char *pathname, int hash_size, int tdb_flags, int open_flags, mode_t mode ); DESCRIPTION
Open the database, creating it if necessary. The hash size is advisory, use zero for a default value. tdb_flags can be one of TDB_CLEAR_IF_FIRST Clear database if we are the only one with it open. TDB_INTERNAL Don't use a file, instead store the data in memory. The pathname , open_flags , and mode are ignored in this case. This is useful if you need a quick associative array or map. TDB_NOLOCK Don't do any locking (this is always turned on for read-only file descriptors) TDB_NOMMAP Don't use mmap. TDB_CONVERT Create a database in the reverse of native endian: normally when the database is created (or cleared with TDB_CLEAR_IF_FIRST), it is created in native endian order. This flag is set (or unset) automatically for existing databases. The open_flags and mode are passed straight to the open call on the database file. A flags value of O_WRONLY is invalid. RETURN VALUE
On success a pointer to an opaque data structure, a TDB_CONTEXT is returned. On error a NULL is returned. AUTHORS
Software: Andrew Tridgell <tridge@linuxcare.com> and Luke Kenneth Casson Leighton Man page: Ben Woodard <ben@valinux.com> SEE ALSO
open(2), gdbm(3), tdb(3) Samba Aug 16, 2000 TDB_OPEN(3)
All times are GMT -4. The time now is 08:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy