Sponsored Content
Top Forums Shell Programming and Scripting Need script to select multiple files from archive directory based on the date range Post 302388923 by rdcwayx on Friday 22nd of January 2010 12:45:18 AM
Old 01-22-2010
Code:
Not tested:

#! /usr/bin/bash

BASE=/projects/home01/archive
DEST=/tmp

for file in `find $BASE -type f -name "*.txt"`
do
   date=$(echo $FILE|awk -F[\/_] '{print $(NF-1)}')
   if [ "$date" > "$1" && "$date" < "$2" ] ; then 
       mv $file $DEST/$file
   fi
done

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

automated ftp script from unix -date range of files

Hi , I need some help to finish my ftp script and i need to find the last one weeks of fles updated in the sepecific directory and see those end with Z and ftp them to my backup server. Any help is appreciated. Thanks, Ravi :) (1 Reply)
Discussion started by: koduri0475
1 Replies

2. Programming

automated ftp script from unix -date range of files

Hi , I need some help to finish my ftp script and i need to find the last one weeks of fles updated in the sepecific directory and see those end with Z and ftp them to my backup server. Any help is appreciated. Thanks, Ravi :) (1 Reply)
Discussion started by: koduri0475
1 Replies

3. Shell Programming and Scripting

Help with Archiving multiple files based on name and date

Dear Gurus, I am a novice in shell scripts. I have a requirement where I need to move files every day from Current Folder to Archive folder. Daily I will be receiving 5 files in the folder - /opt/data/feeds/. The feeds folder has two sub-folders - Current and Archive. For example the... (25 Replies)
Discussion started by: shankar1dada
25 Replies

4. Emergency UNIX and Linux Support

How to move files from a directory which falls between Date Range?

Hi All, I am trying to to move files from a directory to another which falls from Current day - 7 days. The files are in zipped format with dates appended on it. Can you pls help me as this came as a immediate change before the production Release planned next week. Pls let me know if... (11 Replies)
Discussion started by: dsfreddie
11 Replies

5. Shell Programming and Scripting

Moving files from one directory to another based on 2 date variables

Hi All, I am currently coding for a requirement(LINUX OS) where I am supposed to move a file (Lets Call it Employee.txt) from Directory A to Directory B based on 2 date fields as below, Date_Current = 20120620 Date_Previous = 20120610 Source Directory : /iis_data/source Target... (11 Replies)
Discussion started by: dsfreddie
11 Replies

6. Shell Programming and Scripting

Move files from one directory to another based on creation/modification date

Hi All, Really stuck up with a requirement where I need to move a file (Lets say date_Employee.txt--the date will have different date values like 20120612/20120613 etc) from one directory to another based on creation/modification dates. While visiting couple of posts, i could see we can... (3 Replies)
Discussion started by: dsfreddie
3 Replies

7. UNIX for Dummies Questions & Answers

Select all files in a folder based on creation date (ls command)

Hi All, <Re-posting in Correct group> I'm trying to select all the files in a folder that starts with a particular name format and are created in a gven date range using 'ls' command...but i'm not successful.... Example : I'm trying to see all the text files in a folder who names start... (6 Replies)
Discussion started by: Satya C1
6 Replies

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

9. UNIX for Beginners Questions & Answers

Searching for a files based on current date directory

Hi All, I've been trying to do some recursive searching but not been very successful. Can someone please help. Scenario: I have directory structure /dir1/dir2/dir3/ 2019/ 11/ 17 18 19 20 so what I want to do is run a script and as its 2019/11/18/ today it would go and only search... (3 Replies)
Discussion started by: israr75
3 Replies
FAXQCLEAN(8)						      System Manager's Manual						      FAXQCLEAN(8)

NAME
faxqclean - HylaFAX queue cleaner process SYNOPSIS
/usr/sbin/faxqclean [ options ] DESCRIPTION
faxqclean is a program that processes completed HylaFAX jobs and expunges unreferenced document files. This program is intended to be invoked by cron(8) on behalf of the super user (i.e. root) one or more times a day. For example, the following crontab entry might be set- up for root to run faxqclean each hour. 0 * * * * /usr/sbin/faxqclean When faxqclean is run it scans the doneq subdirectory in the HylaFAX spooling area and process each job according to the doneop field spec- ified in the job description file; c.f. sendq(5). Jobs that are marked for removal are purged and references to documents are removed. Jobs that are marked for archival may be archived depending on the options supplied on the command line. After scanning for completed jobs faxqclean scans the docq subdirectory and builds up a table of document files. Files that are not refer- enced by any job and that are older than a specified threshold are removed. OPTIONS
-a Enable job archiving support. -A This option forces archiving even if 'doneop' in the queue file is not 'archive', i.e. even if the user submitted the job without specifying the -A flag to sendfax -j secs Set the job age threshold (in seconds) that controls how long jobs may reside in the doneq directory before being processed. By default this value is 15 minutes (15*60 = 900 seconds). -d secs Set the document age threshold (in seconds) that controls how long unreferenced files may reside in the docq directory before being removed. By default this value is 1 hour (60*60 = 3600 seconds). -n Do not carry out any work; just show what would be done. This option is useful together with the -t option for debugging. -q dir The specified directory is treated as the spooling area. The default spooling area, /var/spool/hylafax, is defined at the time the software is built. -t Trace in great detail exactly what faxqclean is doing. Messages are sent to the standard output. -v Print messages on the standard output about jobs removed or archived and about document files removed. FILES
/var/spool/hylafax/doneq directory to scan for completed jobs /var/spool/hylafax/docq directory to scan for unreferenced documents /var/spool/hylafax/archive directory where archived jobs are placed Consult hylafax-server(5) for a complete discussion of the structure and content of the spooling area. SEE ALSO
faxq(8), hylafax-server(5), sendq(5), doneq(5), archive(5). March 14, 1996 FAXQCLEAN(8)
All times are GMT -4. The time now is 10:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy