Sponsored Content
Top Forums Shell Programming and Scripting How to find the latest file on Unix or Linux (recursive) Post 302500159 by 1or2is3 on Sunday 27th of February 2011 05:06:04 PM
Old 02-27-2011
I have finally found. The following command find the latest file, including the handling of filename with spaces.

find . -type f -printf %p";" | xargs -d ";" ls -t | head -1
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Performing a non-recursive find in Unix

I need to perform a non-recursive find in Unix. Sounds simple, but it doesn't actually work. The command ALWAYS searches through the subdirectories. Any ideas? I am on DEC Unix :-( (3 Replies)
Discussion started by: christallott
3 Replies

2. UNIX for Advanced & Expert Users

find file with date and recursive search for a text

Hey Guyz I have a requirement something like this.. a part of file name, date of modification of that file and a text is entered as input. like Date : 080206 (MMDDYY format.) filename : hotel_rates text : Jim now the file hotel_rates.ZZZ.123 (creation date is Aug 02 2006) should be... (10 Replies)
Discussion started by: rosh0623
10 Replies

3. Shell Programming and Scripting

Find and remove all but the latest file

Hi, Would appreciate if someone could help me with the following requirement. Say I have a directory where a file called abc_$timestamp.txt is created couple of times in a day. So this directory would have files like abc_2007-03-28-4-5-7.txt abc_2007-03-28-3-5-7.txt... (4 Replies)
Discussion started by: hyennah
4 Replies

4. AIX

Unix shell scripting to find latest file having timestamp embedded...

Hi guys, I have a directory in UNIX having files with the below format, i need to pickup the latest file having recent timestamp embedded on it, then need to rename it to a standard file name. Below is the file format: filename_yyyymmdd.csv, i need to pick the latest and move it with the... (2 Replies)
Discussion started by: kaushik25
2 Replies

5. UNIX for Dummies Questions & Answers

How to find the latest file on Unix or Linux

Please help me out how to identify the latest file in one directory by looking at file's timestamp or datestamp. You can say using system command. Thanks (10 Replies)
Discussion started by: duke0001
10 Replies

6. Shell Programming and Scripting

how to use find command to get latest file

Is there a way to use find command to get the latest file and cp it into a certain dir at the same try. example find the latest file and cp to a diff dir. (5 Replies)
Discussion started by: shehzad_m
5 Replies

7. Shell Programming and Scripting

How to find the latest modified file from the unix server.

hi Friends, In my directory i have some files. I need to find out latest modified file. Please help me. Sreenu. (2 Replies)
Discussion started by: sreenu80
2 Replies

8. Shell Programming and Scripting

Recursive find / grep within a file / count of a string

Hi All, This is the first time I have posted to this forum so please bear with me. Thanks also advance for any help or guidance. For a project I need to do the following. 1. There are multiple files in multiple locations so I need to find them and the location. So I had planned to use... (9 Replies)
Discussion started by: Charlie6742
9 Replies

9. UNIX for Dummies Questions & Answers

Recursive Find on file size

Is there a way to use the find command to recursively scan directories for files greater than 1Gb in size and print out the directory path and file name only? Thanks in advance. (6 Replies)
Discussion started by: jimbojames
6 Replies

10. Shell Programming and Scripting

To Find Duplicate files using latest in Linux

I have tried the following code and with that i couldnt achieve what i want. #!/usr/bin/bash find ./ -type f \( -iname "*.xml" \) | sort -n > fileList sed -i '/\.\/fileList/d' fileList NAMEOFTHISFILE=$(echo $0|sed -e 's/\/()$*.^|/\\&/g') sed -i "/$NAMEOFTHISFILE/d"... (2 Replies)
Discussion started by: gold2k8
2 Replies
inc::latest(3pm)					User Contributed Perl Documentation					  inc::latest(3pm)

NAME
inc::latest - use modules bundled in inc/ if they are newer than installed ones SYNOPSIS
# in Build.PL use inc::latest 'Module::Build'; DESCRIPTION
The "inc::latest" module helps bootstrap configure-time dependencies for CPAN distributions. These dependencies get bundled into the "inc" directory within a distribution and are used by Build.PL (or Makefile.PL). Arguments to "inc::latest" are module names that are checked against both the current @INC array and against specially-named directories in "inc". If the bundled version is newer than the installed one (or the module isn't installed, then, the bundled directory is added to the start of <@INC> and the module is loaded from there. There are actually two variations of "inc::latest" -- one for authors and one for the "inc" directory. For distribution authors, the "inc::latest" installed in the system will record modules loaded via "inc::latest" and can be used to create the bundled files in "inc", including writing the second variation as "inc/latest.pm". This second "inc::latest" is the one that is loaded in a distribution being installed (e.g. from Build.PL). This bundled "inc::latest" is the one that determines which module to load. Special notes on bundling The "inc::latest" module creates bundled directories based on the packlist file of an installed distribution. Even though "inc::latest" takes module name arguments, it is better to think of it as bundling and making available entire distributions. When a module is loaded through "inc::latest", it looks in all bundled distributions in "inc/" for a newer module than can be found in the existing @INC array. Thus, the module-name provided should usually be the "top-level" module name of a distribution, though this is not strictly required. For example, Module::Build has a number of heuristics to map module names to packlists, allowing users to do things like this: use inc::latest 'Devel::AssertOS::Unix'; even though Devel::AssertOS::Unix is contained within the Devel-CheckOS distribution. At the current time, packlists are required. Thus, bundling dual-core modules may require a 'forced install' over versions in the latest version of perl in order to create the necessary packlist for bundling. USAGE
When calling "use", the bundled "inc::latest" takes a single module name and optional arguments to pass to that module's own import method. use 'inc::latest' 'Foo::Bar' qw/foo bar baz/; Author-mode You are in author-mode inc::latest if any of the Author-mode methods are available. For example: if ( inc::latest->can('write') ) { inc::latest->write('inc'); } loaded_modules() my @list = inc::latest->loaded_modules; This takes no arguments and always returns a list of module names requested for loading via "use inc::latest 'MODULE'", regardless of whether the load was successful or not. write() inc::latest->write( 'inc' ); This writes the bundled version of inc::latest to the directory name given as an argument. It almost all cases, it should be '"inc"'. bundle_module() for my $mod ( inc::latest->loaded_modules ) { inc::latest->bundle_module($mod, $dir); } If $mod corresponds to a packlist, then this function creates a specially-named directory in $dir and copies all .pm files from the modlist to the new directory (which almost always should just be 'inc'). For example, if Foo::Bar is the name of the module, and $dir is 'inc', then the directory would be 'inc/inc_Foo-Bar' and contain files like this: inc/inc_Foo-Bar/Foo/Bar.pm Currently, $mod must have a packlist. If this is not the case (e.g. for a dual-core module), then the bundling will fail. You may be able to create a packlist by forced installing the module on top of the version that came with core Perl. As bundled in inc/ All methods are private. Only the "import" method is public. AUTHOR
Eric Wilhelm <ewilhelm@cpan.org>, David Golden <dagolden@cpan.org> COPYRIGHT
Copyright (c) 2009 by Eric Wilhelm and David Golden This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
Module::Build perl v5.14.2 2012-06-27 inc::latest(3pm)
All times are GMT -4. The time now is 07:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy