Sponsored Content
Top Forums Shell Programming and Scripting Finding the oldest file in a particular directory Post 302300111 by psiva_arul on Monday 23rd of March 2009 09:13:45 AM
Old 03-23-2009
We can use the below command also for find the latest file in particular directory

ls -gt | tail -1
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Oldest File In A Directory

I'm writing a script to find the oldest file in a directory. I know this can be done by using ls -rt | tail -1 but these are rather large directories and that can be somewhat slow since the script will be running constantly. Are there any other ways to do this that would be faster? I looked to... (2 Replies)
Discussion started by: bergerj3
2 Replies

2. Shell Programming and Scripting

Removing the oldest file in a directory

Hi all, I need your assistance in removing the oldest file in a directory. I posted the same thread 3 days back and I got the following answer ls -1 -t | tail -1 | xargs rm which is not covering the case when there are directories older than the oldest file. So, could you please... (2 Replies)
Discussion started by: pavan_movva
2 Replies

3. Shell Programming and Scripting

how to grep the oldest file in a directory

Hi, Please help me out I want to grep the oldest file in a directory, could I use "ls" command? and how? thanx in advance (1 Reply)
Discussion started by: ericaworld
1 Replies

4. Shell Programming and Scripting

Finding & Moving Oldest File by Parsing/Sorting Date Info in File Names

I'm trying to write a script that will look in an /exports folder for the oldest export file and move it to a /staging folder. "Oldest" in this case is actually determined by date information embedded in the file names themselves. Also, the script should only move a file from /exports to... (6 Replies)
Discussion started by: nikosey
6 Replies

5. Shell Programming and Scripting

Setting Variable to oldest file in a directory

I am using a bash script to perform some automated maintenance on files in a directory. When I run the script using $sh -x script.sh <directory> the script works fine. It sets the variable to the oldest file, and continues on. However when I run the script like this $./script.sh <directory>, it... (5 Replies)
Discussion started by: spaceherpe61
5 Replies

6. Shell Programming and Scripting

Find Oldest file in a directory tree

This might just be one command. Any1 having the solution? Thanks, Rahul. (25 Replies)
Discussion started by: rahulrathod
25 Replies

7. Shell Programming and Scripting

Finding the oldest file

Hi:- I need help with a script I need to modify: - what's the best/easiest way to find out the oldest file in a directory and then move this file to another directory? Thanks, (5 Replies)
Discussion started by: janet
5 Replies

8. UNIX and Linux Applications

Finding the oldest file in a directory without ls

I am trying to determine the oldest and most recent files in a huge directory. I am using an ls -tr statement outside my find statement. The directory is too big and I am getting an "arg list too long" error. Is there something I can put in my find statement that doesn't create a list to... (2 Replies)
Discussion started by: hiyofjord
2 Replies

9. Shell Programming and Scripting

Deleting the oldest file in a directory

Hey! I have found similar posts both here and on other sites regarding this, but I cannot seem to get my script to work. I want to delete the oldest file in a test directory if there are more than two files. My script is currently: #!/bin/bash MEPATH=/usr/local/bin/test FILECOUNT=`ls... (4 Replies)
Discussion started by: Immolation
4 Replies

10. UNIX for Advanced & Expert Users

Finding oldest files

There are some 25,000 files in 7,000 directories in my source library and I am trying to find oldest files. I am running this find: find /usr/mysrc -name "*." -type f -mtime +8000 -exec ls -l {} 2>/dev/null and playing with the days parameter for mtime, but the output is not sorted... (3 Replies)
Discussion started by: migurus
3 Replies
AMANDA-TAPERSCAN(7)						    Miscellanea 					       AMANDA-TAPERSCAN(7)

NAME
amanda-taperscan - Amanda Taperscan Algorithms DESCRIPTION
Amanda uses a taperscan algorithm to select volumes on which to store dumps. Historically Amanda has provided only one, fairly complex taperscan algorithm, but this algorithm did not suit the needs of all users. Now Amanda offers a wide array of algorithms to suit varied needs. Adding new algorithms is not difficult. The taperscan algorithm is specified with the taperscan parameter, which has a default value of traditional. Taperscan algorithms are implemented as perl packages with the prefix Amanda::Taper::Scan::. See the perl documentation for Amanda::Taper::Scan for more information. DEFINING A TAPERSCAN
An taperscan is defined in amanda.conf(5) as follows: define taperscan $taperscan_name { comment "$comment" plugin "$pluginname" property "$PROPERTY_NAME" "$PROPERTY_VALUE" ... } and then referenced in the global section as taperscan "$taperscan_name" Taperscan properties, like Amanda configuration parameters, are insensitive to case, and - (dash) and _ (underscore) may be used interchangeably. See the individual plugin documentation below for properties applicable to each plugin. TAPERSCAN ALGORITHMS
In general, these algorithms will only select reusable volumes. These are volumes which are listed in the tapelist(5) with the reuse flag, and which are not among the tapecycle-1 most recent volumes in the list. Put another way, reusable volumes do not contain data that must be retained. Note that if fewer than tapecycle-1 volumes have been written then there are no reusable volumes. Newly labeled volumes (volumes that have been labeled with amlabel but never used) are considered reusable. Many of these algorithms look for the oldest reusable volume. In most cases, this is the best volume to overwrite, as the data it contains is older than that on any other volume. If there are no reusable volumes, then there is no oldest reusable volume. traditional This algorithm duplicates Amanda's historical behavior, and it operates in two stages. First, if there is an oldest reusable volume and if the changer supports "fast" searches, then the algorithm uses the changer to search for that volume. Newly labeled volumes are not considered when calculating the oldest reusable volume. Consequently, this taperscan algorithm prefers volumes which have been used before to newly-labeled volumes when a fast-searchable changer is in use. Second, if there is no oldest reusable volume, or if that volume is not available in the changer, then the algorithm begins a sequential scan of the changer, starting at the current slot. It selects the first suitable volume it finds: a reusable volume (perhaps newly-labeled) or, if autolabel includes empty, a blank volume. Even across multiple invocations (when runtapes > 1), it will not return the same slot twice. Note This algorithm shows an undue preference for volumes already containing data, by omitting newly-labeled volumes from its first stage. Historically, many Amanda changer scripts were not fast-searchable (including chg-multi, chg-disk and, if havereader=0, chg-zd-mtx), and thus skipped the first stage, allowing new volumes to find their way into the tape cycle. New changers are almost all fast-searchable, so both stages of the algorithm are used and new tapes may be unexpectedly excluded. If this causes an undesirable change in behavior, consider one of the other taperscan algorithms..sp .5v oldest This algorithm works with the Changer API (see amanda-changers(7)), using the inventory returned by the changer to locate the oldest acceptable volume available. Note that this will not work with changers that do not support inventory (old changers). The algorithms scans unknown slots only if no known usable volume is found in the inventory. An acceptable volume is a reusable volume, a new labeled volume or an unlabeled volume that can be labeled according to autolabel. Note that changers do not always know the contents of every slot - for example, a tape with an unknown barcode will not be considered usable. Use amtape CONF inventory to see the changer's inventory, and use amtape CONF update to update it. lexical This algorithm also works with the Changer API, using the inventory to determine the acceptable volumes; it then uses the volume which follows the last-used volume in lexical order. For volume labels containing leading zeros, e.g., CORP-010, this algorithm will run through the volumes in the natural order. It scans unknown slots only if no usable volume is found in the inventory. See oldest, above, for a definition of acceptable volumes. SEE ALSO
amanda(8), amanda.conf(5), tapelist(5), amanda-changers(7), amanda-interactivity(7) The Amanda Wiki: : http://wiki.zmanda.com/ AUTHOR
Dustin J. Mitchell <dustin@zmanda.com> Zmanda, Inc. (http://www.zmanda.com) Amanda 3.3.1 02/21/2012 AMANDA-TAPERSCAN(7)
All times are GMT -4. The time now is 07:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy