Sponsored Content
Top Forums Shell Programming and Scripting Delete the files by exact date Post 302551138 by Shell_Life on Monday 29th of August 2011 01:21:44 PM
Old 08-29-2011
Quote:
Originally Posted by itkamaraj
Code:
ls -l | grep "Mar 10" | while read line; do fileName=$(echo $line | awk '{print $NF}'); echo "rm $fileName"; done

Selecting "Mar 10" only, will display files for different years.

The following will make sure the year, month and day are considered:
Code:
#!/usr/bin/ksh
touch -t 201103100000 File_From
touch -t 201103102359 File_To
for mFName in *; do
  if [[ ${mFName} -nt File_From && $mFName -ot File_To ]]; then
    echo "Now removing <${mFName}>"
    rm ${mFName}
  fi
done

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to delete files by date

My apache logs are saved in the following format (using rotatelogs): Oct 8 01:59 access_log.1002412800 Oct 9 01:55 access_log.1002499200 Oct 10 01:58 access_log.1002585600 Oct 11 01:56 access_log.1002672000 Oct 12 01:59 access_log.1002758400 I would like to run a cronjob once a week to... (2 Replies)
Discussion started by: jamesbond
2 Replies

2. UNIX for Dummies Questions & Answers

How can i delete files in folder by date?

Hi, I have some files on a folder and i want to delete all the files that were created on July. Thanks, Kobi. (9 Replies)
Discussion started by: kobibn
9 Replies

3. UNIX for Dummies Questions & Answers

Delete files by date

Hi, Can anyone help me delete old files in a directory? Let's say, I want to delete all files which are 365 days old. Thank you. (2 Replies)
Discussion started by: risk_sly
2 Replies

4. Solaris

Delete files according to date

Hi All, I am wondering whether is there a way to remove files according to date. For example, I have 500 files between Jan - April, and I want to remove files created only on March. Is there any way to do this? Thanks in advanced. rgds, Ronny (2 Replies)
Discussion started by: ronny_nch
2 Replies

5. Shell Programming and Scripting

find files for a particular date and delete

How can I delete files for a particular date ? I apologize in advance If there is solution please put the link. Thanks, (5 Replies)
Discussion started by: jville
5 Replies

6. Shell Programming and Scripting

Delete files by date

Hello, Due to an error while processing data I have to delete all files created the 4 october on a RED HAT 3 Server. I am wondering if one of you is aware of a command that could only delete all files that were created the Oct 4 This will be very, very, very helpful Thanks for your... (6 Replies)
Discussion started by: Aswex
6 Replies

7. UNIX Desktop Questions & Answers

How to delete files from a specific date?

Guys, I am wondering how to remove files for a specific date in a directory? for instance when I do ls -l , i see many files. And i want to delete files for date May 15: 58252015 May 10 03:45 my_05102012.log 58252015 May 15 06:45 my_05152012.log Thanks (8 Replies)
Discussion started by: DallasT
8 Replies

8. Shell Programming and Scripting

Delete log files content older than 30 days and append the lastest date log file date

To delete log files content older than 30 days and append the lastest date log file date in the respective logs I want to write a shell script that deletes all log files content older than 30 days and append the lastest log file date in the respective logs This is my script cd... (2 Replies)
Discussion started by: sreekumarhari
2 Replies

9. UNIX for Dummies Questions & Answers

Delete files of a particular date

dear all, i m a newbie and i want to delete all files of a particular date,how can i do this? your help appreciated,thanks in advance. OS:RHEL 6 (5 Replies)
Discussion started by: mdabdul
5 Replies

10. UNIX for Dummies Questions & Answers

Delete Files from a date

I'm quite new to Unix but I want to delete some old backup files stored in a directory. the backups are stored on a network storage device located at /mnt/terastation12/backup. I want to delete everything upto one month ago. would the following command in Unix Sun do that? find... (5 Replies)
Discussion started by: dbajtr
5 Replies
Locale::Codes::LangFam(3)				User Contributed Perl Documentation				 Locale::Codes::LangFam(3)

NAME
Locale::Codes::LangFam - standard codes for language extension identification SYNOPSIS
use Locale::Codes::LangFam; $lext = code2langfam('apa'); # $lext gets 'Apache languages' $code = langfam2code('Apache languages'); # $code gets 'apa' @codes = all_langfam_codes(); @names = all_langfam_names(); DESCRIPTION
The "Locale::Codes::LangFam" module provides access to standard codes used for identifying language families, such as those as defined in ISO 639-5. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default ISO 639-5 language family codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language families. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lext = code2langfam('apa','alpha'); $lext = code2langfam('apa',LOCALE_LANGFAM_ALPHA); The codesets currently supported are: alpha This is the set of three-letter (lowercase) codes from ISO 639-5 such as 'apa' for Apache languages. This is the default code set. ROUTINES
code2langfam ( CODE [,CODESET] ) langfam2code ( NAME [,CODESET] ) langfam_code2code ( CODE ,CODESET ,CODESET2 ) all_langfam_codes ( [CODESET] ) all_langfam_names ( [CODESET] ) Locale::Codes::LangFam::rename_langfam ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangFam::add_langfam ( CODE ,NAME [,CODESET] ) Locale::Codes::LangFam::delete_langfam ( CODE [,CODESET] ) Locale::Codes::LangFam::add_langfam_alias ( NAME ,NEW_NAME ) Locale::Codes::LangFam::delete_langfam_alias ( NAME ) Locale::Codes::LangFam::rename_langfam_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangFam::add_langfam_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangFam::delete_langfam_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.loc.gov/standards/iso639-5/id.php ISO 639-5 . AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2013 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.3 2013-02-27 Locale::Codes::LangFam(3)
All times are GMT -4. The time now is 07:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy