Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Searching for a files based on current date directory Post 303041233 by apmcd47 on Tuesday 19th of November 2019 04:43:15 AM
Old 11-19-2019
You don't say what system you are running this on. Assuming a Linux system and/or Gnu Date you could use something like:
Quote:
#!/bin/bash
now=$(date)
list_dir=$(date +'%Y/%m/%d')
echo /dir1/dir2/dir3/${list_dir}
now_in_secs=$(date +%s)
dir_in_secs=$(date +%s --reference=/dir1/dir2/dir3/${list_dir})
printf "directory %s was last added to or removed from %d seconds ago\n" ${list_dir} $((now_in_secs - dir_in_secs))
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Searching for files over 30 days old in current directory

May be a simple question for experts here.... I need to get the list of files older than 30 days in the current folder. I tried "find", but it searches recursively in all the sub directories. Can I restrict the recursive search and extract the files only from current directory ? (18 Replies)
Discussion started by: cxredd4
18 Replies

2. Shell Programming and Scripting

searching files through all subdirectories beneath the current directory

i want to make a bash script that searches a specific pattern in files through all subdirectories beneath the current directory..without using the command grep-R but only the command grep.. e.g for i in * do grep "pattern" $i ..... ... done using the character (*) the script... (5 Replies)
Discussion started by: milagros
5 Replies

3. Shell Programming and Scripting

searching content of files in the current and sub directories

Hi I was wondering why command 2 doesn't work like command 1 below. 1. find . -exec grep "test" '{}' \; -print 2. ls -R | grep "test" I am trying to search "test" from all the files in the current and sub directories. What's wrong with my command 2? Thanks in advance for your help (4 Replies)
Discussion started by: tiger99
4 Replies

4. Shell Programming and Scripting

Finding files in current directory when 100,000's files in current directory

Hi All I was wondering what is the most efficient way to find files in the current directory(that may contain 100,000's files), that meets a certain specified file type and of a certain age. I have experimented with the find command in unix but it also searches all sub directories. I have... (2 Replies)
Discussion started by: kewong007
2 Replies

5. Shell Programming and Scripting

Need script to select multiple files from archive directory based on the date range

hi all, here is the description to my problem. input parameters: $date1 & $date2 based on the range i need to select the archived files from the archived directory and moved them in to working directory. can u please help me in writing the code to select the multiple files based on the... (3 Replies)
Discussion started by: bbc17484
3 Replies

6. UNIX for Dummies Questions & Answers

Create a directory using current date

Hi, I have a question, is there any way I can, when i create a directory, put the current date on it so that the directory name will be "name-current date"? just curious (3 Replies)
Discussion started by: aric87
3 Replies

7. Shell Programming and Scripting

I need to back up a bunch of files on a directory and save that file as the current date....

this is what i have to find the files modified within the past 24 hours find . -mtime -1 -type f -print0 | xargs -0 tar rvf "$archive.tar" however i need to save/name this archive as the current date (MM-DD,YYYY.tar.gz) how do i doo this (1 Reply)
Discussion started by: bugenhagen_
1 Replies

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

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

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
RAIDFILE-CONFIG(8)						    Box Backup							RAIDFILE-CONFIG(8)

NAME
raidfile-config - Configure Box Backup's RAID files SYNOPSIS
raidfile-config config-dir blocksize dir1 [dir2 [dir3]] DESCRIPTION
raidfile-config creates a raidfile.conf file for Box Backup. This file holds information about the directories used to store backups in. Box Backup supports userland RAID, in a restricted RAID5 configuration, where 3 and only 3 'drives' are supported. You can read more about RAID5 (and other RAID-levels) here[1]. Parameters The parameters are as follows: config-dir The directory path where configuration files are located. Usually this is /etc/box. raidfile.conf will be written in this directory. blocksize The block size used for file storage in the system, in bytes. Using a multiple of the file system block size is a good strategy. Depending on the size of the files you will be backing up, this multiple varies. Of course it also depends on the native block size of your file system. dir1 The first directory in the built-in RAID array. dir2 The second directory in the built-in RAID array. If you are not using the built-in RAID functionality, this field should be ignored. You should not use the built-in RAID if you have a hardware RAID solution or if you're using another type of software RAID (like md on Linux). dir3 The third directory in the built-in RAID array. The same notes that apply to dir2 also apply to dir3. Note that there are currently no way to add multiple disk sets to the raidfile.conf file using command line tools, etc. See raidfile.conf(5) for details on adding more disks. BUGS
If you find a bug in Box Backup, and you want to let us know about it, join the mailing list[2], and send a description of the problem there. To report a bug, give us at least the following information: o The version of Box Backup you are running o The platform you are running on (hardware and OS), for both client and server. o If possible attach your config files (bbstored.conf, bbackupd.conf) to the bug report. o Also attach any log file output that helps shed light on the problem you are seeing. o And last but certainly not least, a description of what you are seeing, in as much detail as possible. FILES
raidfile-config generates the raidfile.conf(5) file. SEE ALSO
bbstored-config(8), bbstored.conf(5), raidfile.conf(5) AUTHORS
Ben Summers Per Thomsen James O'Gorman NOTES
1. here http://en.wikipedia.org/wiki/Redundant_array_of_independent_disks#RAID_5 2. mailing list http://lists.warhead.org.uk/mailman/listinfo/boxbackup Box Backup 0.11 10/28/2011 RAIDFILE-CONFIG(8)
All times are GMT -4. The time now is 10:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy