Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Find the files based on date from filelist Post 303039240 by jim mcnamara on Thursday 26th of September 2019 07:33:37 PM
Old 09-26-2019
The content of the file list, i.e., filenames, has no associated filesystem metadata for any of the files named in your text file. You would have use the stat command on each one of the filenames in the text file.
And you will have to use epoch times ( seconds since Jan 1 1970).
Code:
when=1569540363
while read filename
do
  [ $(stat --format=%Y filename) -gt $when  ] && echo $filename
done < textfile

It is easier with a reference file that has been set to a specified mtime file with the touch command, shell does file time comparisons ( -ot, -nt ):
Code:
[ $file -nt $reference_filename ] && echo $filename

Can you create the text file list first with both a filename and a filetime (in epoch seconds) for each line in the text file? And then read that?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Help on cat filelist.txt |xargs -n1 find

I am trying to find all the files listed in a filelist.txt. Why cant I use something like this cat filelist.txt | xargs -n1 find $path (2 Replies)
Discussion started by: dragonpoint
2 Replies

2. Shell Programming and Scripting

Find and copy files based on todays date and search for a particular string

Hi All, I am new to shell srcipting. Problem : I need to write a script which copy the log files from /prod/logs directory based on todays date like (Jul 17) and place it to /home/hzjnr0 directory and then search the copied logfiles for the string "@ending successfully on Thu Jul 17". If... (2 Replies)
Discussion started by: mail.chiranjit
2 Replies

3. Shell Programming and Scripting

move files defined in filelist

Hi, I have a filelist named filestomove.txt. It can contain any number of files that need to be moved to a subdirectory. All the files from filelist are in the same directory as the filelist, let say it's called Folder1. All the files need to be moved to subfolder Folder1/Subfolder1. ... (1 Reply)
Discussion started by: kedrick
1 Replies

4. Shell Programming and Scripting

Find and count unique date values in a file based on position

Hello, I need some sort of way to extract every date contained in a file, and count how many of those dates there are. Here are the specifics: The date format I'm looking for is mm/dd/yyyy I only need to look after line 45 in the file (that's where the data begins) The columns of... (2 Replies)
Discussion started by: ronan1219
2 Replies

5. Shell Programming and Scripting

Find the latest file based on the date in the filename

Hi, We've a list of files that gets created on a weekly basis and it has got a date and time embedded to it. Below are the examples. I want to find out how to get the latest files get the date and time stamp out of it. Files are PQR123.PLL.M989898.201308012254.gpg... (1 Reply)
Discussion started by: rudoraj
1 Replies

6. UNIX for Dummies Questions & Answers

Looking for command line to find dirs based on size and date

Hi, My first time on this site, please excuse me if I've come to the wrong forum. I'm fairly new to Unix/Linux and hoping you can help me out. I'm looking for a command line that will return a list of directories that are larger than 50M and older than 2 days. I thought it may be... (6 Replies)
Discussion started by: Wisconsingal
6 Replies

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

8. Shell Programming and Scripting

Find fields based on date criterion

Hi All , I am trying to find some non empty files from a directory based on below conditions : Files:: SIZE DATE FILE 3679 Jan 25 23:59 belk_rpo_error_po9324892_01252014.log 0 Jul 01 06:30 belk_rpo_error_po9324267_07012014.log 0 Jul 20 05:50... (7 Replies)
Discussion started by: LoneRanger
7 Replies

9. UNIX for Dummies Questions & Answers

Find the count of files by last created date based on the given date range

My unix version is IBM AIX Version 6.1 I tried google my requirement and found the below answer, find . -newermt “2012-06-15 08:13" ! -newermt “2012-06-15 18:20" But newer command is not working in AIX version 6.1 unix I have given my requirement below: Input: atr files: ... (1 Reply)
Discussion started by: yuvaa27
1 Replies

10. UNIX for Beginners Questions & Answers

Find and copy .zip file based on today's date

Hi Team, I'm new to unix and i have a requirement to copy or move files from one directory to another based on current date mentioned in the .zip file name. Note that i need to copy only the recent zip file. please help me with the code i tried the code as: #! /usr/bin/sh find... (3 Replies)
Discussion started by: midhun3108
3 Replies
GNULIB-TOOL(1)						      GNU Portability Library						    GNULIB-TOOL(1)

NAME
gnulib-tool - program for authors or maintainers which want to import modules from gnulib into their packages. SYNOPSIS
gnulib-tool --list gnulib-tool --import [module1 ... moduleN] gnulib-tool --update gnulib-tool --create-testdir --dir=directory module1 ... moduleN gnulib-tool --create-megatestdir --dir=directory [module1 ... moduleN] gnulib-tool --test --dir=directory module1 ... moduleN gnulib-tool --megatest --dir=directory [module1 ... moduleN] gnulib-tool --extract-description module gnulib-tool --extract-filelist module gnulib-tool --extract-dependencies module gnulib-tool --extract-autoconf-snippet module gnulib-tool --extract-automake-snippet module gnulib-tool --extract-include-directive module gnulib-tool --extract-license module gnulib-tool --extract-maintainer module gnulib-tool --extract-tests-module module DESCRIPTION
The GNU portability library is a macro system and C declarations and definitions for commonly-used API elements and abstracted system behaviors. It can be used to improve portability and other functionality in your programs. OPTIONS
Operation modes: --list print the available module names. --import import the given modules into the current package; if no modules are specified, update the current package from the current gnulib. --update update the current package, restore files omitted from CVS. --create-testdir create a scratch package with the given modules. --create-megatestdir create a mega scratch package with the given modules one by one and all together. --test test the combination of the given modules (recommended to use CC="gcc -Wall" here). --megatest test the given modules one by one and all together (recommended to use CC="gcc -Wall" here). --extract-description extract the description. --extract-filelist extract the list of files. --extract-dependencies extract the dependencies. --extract-autoconf-snippet extract the snippet for configure.ac. --extract-automake-snippet extract the snippet for lib/Makefile.am. --extract-include-directive extract the #include directive. --extract-license report the license terms of the source files under lib/. --extract-maintainer report the maintainer(s) inside gnulib. --extract-tests-module report the unit test module, if it exists. Options: --dir=DIRECTORY specify the target directory. For --import, this specifies where your configure.ac can be found. Defaults to current directory. --lib=LIBRARY Specify the library name. Defaults to 'libgnu'. --source-base=DIRECTORY Directory relative --dir where source code is placed (default "lib"), for --import. --m4-base=DIRECTORY Directory relative --dir where *.m4 macros are placed (default "m4"), for --import. --tests-base=DIRECTORY Directory relative --dir where unit tests are placed (default "tests"), for --import. --aux-dir=DIRECTORY Directory relative --dir where auxiliary build tools are placed (default "build-aux"). --with-tests Include unit tests for the included modules. --avoid=MODULE Avoid including the given MODULE. Useful if you have code that provides equivalent functionality. This option can be repeated. --lgpl Abort if modules aren't available under the LGPL. Also modify license template from GPL to LGPL. --libtool Use libtool rules, for --import. --macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and 'gl_INIT'. Default is 'gl'. --no-changelog don't update or create ChangeLog files. --dry-run For --import, only print what would have been done. -s, --symbolic, --symlink Make symbolic links instead of copying files. -h, --help Show summary of options. BUGS
Report bugs to <bug-gnulib@gnu.org>. SEE ALSO
check-module(1). AUTHOR
gnulib was written by the Free Software Foundation and others (sources of various origins). This manual page was written by Daniel Baumann <daniel@debian.org>, for the Debian project (but may be used by others). 0.0.20060601 2006-06-01 GNULIB-TOOL(1)
All times are GMT -4. The time now is 06:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy