Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Moving files based on creation date Post 3323 by Optimus_P on Thursday 28th of June 2001 05:43:02 PM
Old 06-28-2001
Code:
case "$1" in

'-d')

DIR=${2:?"bad or missing Directory"}
CREATE=${3:?"missing Creation Date"}
NEWDIR=`echo $CREATE|awk '{ print $1$2 }'`

for creationdate in $DIR ; do
        if [[ -d $NEWDIR ]];then
                mv `ls -l|grep "$CREATE"|grep -v $NEWDIR|awk '{ print $9 }'` $NEWDIR
        else
                mkdir $NEWDIR
                mv `ls -l|grep "$CREATE"|grep -v $NEWDIR|awk '{ print $9 }'` $NEWDIR
        fi
done
;;

*)
        echo
        echo "Usage: $0 [-d] <directory/to/search> <Date to look for>"
        echo "Example: $0 -d /home0/user \"Jun 28\""
        echo
;;
esac

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

mp3 tag/rename based on creation (last modified date)

Arg, I'm trying to figure out how to create a album tag based on the last modified date stamp for files which don't have a corresponding .talk file. IE. 2009 12 10 - Talk Radio.mp3 is how I want them structured, they should all have a corresponding .talk file so my mp3 player can speak the name ie... (0 Replies)
Discussion started by: mrplow
0 Replies

2. UNIX for Dummies Questions & Answers

Moving Directories Based on Modified date

Hi, How can I move directories (and all sub directories/files) from one directory to another based on the modified date of the directory? Currently the existing structure looks like this: /public_html/media/videos/tmb/34947/image1.jpg /public_html/media/videos/tmb/34947/image2.jpg ... (0 Replies)
Discussion started by: lbargers
0 Replies

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

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

5. UNIX for Dummies Questions & Answers

Script moving files based on date

Hi, I need a script that moves files based on date to a folder. The folder should be created based on file date. Example is : Date file name ----- -------- Oct 08 07:39 10112012_073952.xls Oct 09 07:39 10112012_073952.xls Oct 10 07:39 ... (6 Replies)
Discussion started by: rockingvj
6 Replies

6. Shell Programming and Scripting

Moving files based on file creation

Hi, I have a directory having so many number of files. Now I want to move the files which are older than one month (lets say) from this directory to another directory (say BKP dir). Simply, if file is olderthan one month move it from source1 dir to BKP1 dir. My file names doesn't have... (7 Replies)
Discussion started by: karumudi7
7 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

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

9. Shell Programming and Scripting

Bourne returning files based on creation date

I'm wanting to write a bourne shell script that takes in two command line arguments - a directory and a file. With this I want to return a list of files within the directory that are older (based on creation date) than the given file, and print the number of files that have not been listed (they... (4 Replies)
Discussion started by: britty4
4 Replies
gettext(3)						User Contributed Perl Documentation						gettext(3)

NAME
Locale::gettext - message handling functions SYNOPSIS
use Locale::gettext; use POSIX; # Needed for setlocale() setlocale(LC_MESSAGES, ""); # OO interface my $d = Locale::gettext->domain("my_program"); print $d->get("Welcome to my program"), " "; # (printed in the local language) # Direct access to C functions textdomain("my_program"); print gettext("Welcome to my program"), " "; # (printed in the local language) DESCRIPTION
The gettext module permits access from perl to the gettext() family of functions for retrieving message strings from databases constructed to internationalize software. $d = Locale::gettext->domain(DOMAIN) $d = Locale::gettext->domain_raw(DOMAIN) Creates a new object for retrieving strings in the domain DOMAIN and returns it. "domain" requests that strings be returned as Perl strings (possibly with wide characters) if possible while "domain_raw" requests that octet strings directly from functions like "dgettext()". $d->get(MSGID) Calls "dgettext()" to return the translated string for the given MSGID. $d->cget(MSGID, CATEGORY) Calls "dcgettext()" to return the translated string for the given MSGID in the given CATEGORY. $d->nget(MSGID, MSGID_PLURAL, N) Calls "dngettext()" to return the translated string for the given MSGID or MSGID_PLURAL depending on N. $d->ncget(MSGID, MSGID_PLURAL, N, CATEGORY) Calls "dngettext()" to return the translated string for the given MSGID or MSGID_PLURAL depending on N in the given CATEGORY. $d->dir([NEWDIR]) If NEWDIR is given, calls "bindtextdomain" to set the name of the directory where messages for the domain represented by $d are found. Returns the (possibly changed) current directory name. $d->codeset([NEWCODE]) For instances created with "Locale::gettext->domain_raw", manuiplates the character set of the returned strings. If NEWCODE is given, calls "bind_textdomain_codeset" to set the character encoding in which messages for the domain represented by $d are returned. Returns the (possibly changed) current encoding name. gettext(), dgettext(), and dcgettext() attempt to retrieve a string matching their "msgid" parameter within the context of the current locale. dcgettext() takes the message's category and the text domain as parameters while dcgettext() defaults to the LC_MESSAGES category and gettext() defaults to LC_MESSAGES and uses the current text domain. If the string is not found in the database, then "msgid" is returned. ngettext(), dngettext(), and dcngettext() function similarily but implement differentiation of messages between singular and plural. See the documentation for the corresponding C functions for details. textdomain() sets the current text domain and returns the previously active domain. bindtextdomain(domain, dirname) instructs the retrieval functions to look for the databases belonging to domain "domain" in the directory "dirname" bind_textdomain_codeset(domain, codeset) instructs the retrieval functions to translate the returned messages to the character encoding given by codeset if the encoding of the message catalog is known. NOTES
Not all platforms provide all of the functions. Functions that are not available in the underlying C library will not be available in Perl either. Perl programs should use the object interface. In addition to being able to return native Perl wide character strings, "bind_textdomain_codeset" will be emulated if the C library does not provide it. VERSION
1.05. SEE ALSO
gettext(3i), gettext(1), msgfmt(1) AUTHOR
Phillip Vandry <vandry@TZoNE.ORG> perl v5.16.3 2014-06-10 gettext(3)
All times are GMT -4. The time now is 03:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy