Sponsored Content
Top Forums Shell Programming and Scripting Find Oldest file in a directory tree Post 302199006 by scarfake on Sunday 25th of May 2008 03:52:34 PM
Old 05-25-2008
Quote:
Originally Posted by pozar
in all the subdirectories...

find . -type f -printf "%T@ %p \n" | sort -n -k 1,1 | awk '{print $2}'

Tim
thanks tim this is a perfect one!!
 

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

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

5. Shell Programming and Scripting

Finding the oldest file in a particular directory

Hi all, I am a newbie to scripting and I need your help regarding finding the oldest file in a particular directory. My intention is to remove that oldest file. Are there any options available with the "find" command to do this.. Thanks in advance for your help Pavan (4 Replies)
Discussion started by: pavan_movva
4 Replies

6. 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

7. 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

8. Shell Programming and Scripting

How to find files in directory tree by date

I'm using a directory naming convention to organize files as exemplified here: 2012/Aug/week-20-Aug/23-Thu/tuv.txt 2012/Aug/week-27-Aug/30-Thu/abc.txt 2012/Sep/week-27-Aug/01-Sat/def.txt 2012/Sep/week-03-Sep/07-Fri/xyz.txt How do I write a command that will list the file names abc.txt and... (4 Replies)
Discussion started by: siegfried
4 Replies

9. UNIX for Dummies Questions & Answers

How to find directory listing from root to all files in tree format with details of perm/own/grp?

Hi, My apologies if my query is already available on this forum but I am new and could not find. I need a script to list all directories/sub directories and files with permissions/groups/owners. The script would run from home directory and should capture every directory. How do I do this? ... (4 Replies)
Discussion started by: 8709711
4 Replies

10. UNIX for Dummies Questions & Answers

Unable to find files, those can be present anywhere in the directory tree,based on its creation date

Hi I am unable to find files, those are present anywhere in the same directory tree, based on the creation date. I need to find the files with their path, as I need to create them in another location and move them. I need some help with a script that may do the job. Please help (2 Replies)
Discussion started by: sam192837465
2 Replies
S2RAM(8)                                                               s2ram                                                              S2RAM(8)

NAME
s2ram - program to suspend to ram (suspend) SYNOPSIS
s2ram [-h, --help] [-V, --vesion] [-n, --test] [-i, --identify] [--nofbsuspend] [--force] [--vbe_save] [--vbe_mode] [--radeontool] [--acpi_sleep nr] [--pci_save] DESCRIPTION
This manual page documents briefly the s2ram command. This manual page was written for the Debian(TM) distribution because the original program does not have a manual page. s2ram is a program that will suspend your system to ram (put it in S3 mode). Which means that the system is in a lower power mode. It asked to do so it will wake up farely quickly. However, if the system will run out of energy entirely you will lose data. That is why it is recommended to use s2both(8) s2ram is only provided to find out any work around needed to make suspend to both work. See README.s2ram-whitelist and README.Debian for more information. OPTIONS
-h, --help Short help text. -V, --version Version information. -n, --test test if the machine is in the database. returns 0 if known and supported -i, --identify prints a string that identifies the machine. --nofbsuspend do not suspend the framebuffer (for debugging purposes). --force force suspending, even on unknown machines. the following options are only available with --force. --vbe_save save VBE state before suspending and restore after resume. --vbe_post VBE POST the graphics card after resume. --vbe_mode get VBE mode before suspend and set it after resume. --radeontool turn off the backlight on radeons before suspending. -v, --pci_save Save the PCI config space of the VGA card before suspend and restore it after resume. --acpi_sleep nr set the acpi_sleep parameter before suspend. 1=s3_bios, 2=s3_mode, 3=both SEE ALSO
s2both (8). For more information see the /usr/share/doc/uswsusp/README.s2ram-whitelist and the /usr/share/doc/uswsusp/README.Debian AUTHOR
This manual page was written by Tim Dijkstra tim@famdijkstra.org for the Debian(TM) system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. AUTHOR
TimTim DijkstraDijkstra <tim@famdijkstra.org> <tim@famdijkstra.org> Wrote this manpage for the Debian system. COPYRIGHT
Copyright (C) 2006 Tim Dijkstra uswsusp juni 24, 2006 S2RAM(8)
All times are GMT -4. The time now is 11:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy