In theory, this should be fairly straightforward. If you want to delete all files created from 2017 and beyond (i.e. also files from 2016, 2015, etc - anything older than 2017), then you could do something like this:
That would find all files older than 549 days (at the time of writing, the number of days since December 31st 2017) and remove them.
Now, if you really want to only remove files from 2017, and only 2017, then it's slightly more complicated, but not much so. Assuming your version of find supports it, this would do the trick:
This will very specifically remove files whose modification time is newer than 1st January 2017, but not newer than 1st January 2018 (in other words - files from 2017).
Hope this helps. Please test carefully before running this with a live rm command - swap it out for an ls or switch out the -exec for a -print first just to be sure it really is going to catch what you want, and only what you want, before turning this loose on your filesystem for real.
These 2 Users Gave Thanks to drysdalk For This Post:
I'm trying to delete files that were created/modified in the year 2005 that we compressed and have the .Z extension on them. I tried using the awk utility but the syntax is incorrect. I don't know how to use a wildcard to capture all the compressed files. Here's the code I used
( ls -lR |... (5 Replies)
Hi,
Would like to ask, which command is used to list all the files for specific date (says 1st May) and its size, for all files (including its subdirectory), in a mounted NFS disk to HP-UX.
I would like to check for the total files came into my disk on 1st May.
Very much appreciating your... (2 Replies)
There is a system logging a huge amount of data and we need to delete some of the older logs .I mean the files that are created before one week from today. Here is a listing of files that are sitting there:
/usr/WebSphere/AppServer/logs
# ls -l
-rw-r--r-- 1 root system 3740694 May... (5 Replies)
can someone provide a command to delete files by year? I have several files created last year 2009.
Im trying to list first ls -lrt | grep '/2009/ {print $10}' by it returns no result.
Pls advise (2 Replies)
Hi
I have lot of files and subdirectories inside a directory which are created in the years 2006, 2007, 2008, 2009 and 2010.
I want to delete all the files and subdirectories belonging to the year 2006 alone.
How can I do that ? (5 Replies)
Hi All,
I want to login to a remote server using FTP command and then check for files older than 1 year and delete those files.
Please let me know how can i achieve this using Unix Commands.
Thanks in Advance, (10 Replies)
Hi,
I want to display the file names and the record count for the files in the 2nd column for the files created today.
i have written the below command which is listing the file names. but while piping the above command to the wc -l command
its not working for me.
ls -l... (5 Replies)
Hi All,
how can i delete files from my Unix directory on the basis of year, i have files from 2001 to till 2014, but from their, i have to delete only 2013 file.Below is my file name
rwxrwxrwx 1 guopt users 5169 Jul 12 00:30 grt592_20130712003000.SAP
Thanks
Kki (2 Replies)
Hi
My directory structure is as below.
dir1, dir2, dir3
I have the list of files to be deleted in the below path as below.
/staging/retain_for_2years/Cleanup/log $ ls -lrt
total 0
drwxr-xr-x 2 nobody nobody 256 Mar 01 16:15 01-MAR-2015_SPDBS2
drwxr-xr-x 2 root ... (2 Replies)
Hello Gurus,
I am facing one issue to get a file for a specific time. There are about 300 files created between 6.30 pm to 7.15 pm everyday.
Now I wanted only the file which is created on 6.45pm. No other files required.
I have used "find" command to get the files, but not getting the expected... (3 Replies)
Discussion started by: pokhraj_d
3 Replies
LEARN ABOUT DEBIAN
mknmz
MKNMZ(1) Namazu Project MKNMZ(1)NAME
mknmz - an indexer of Namazu
SYNOPSIS
mknmz [options] <target>...
DESCRIPTION
mknmz 2.0.21, an indexer of Namazu.
Target files:
-a, --all
target all files.
-t, --media-type=MTYPE
set the media type for all target files to MTYPE.
-h, --mailnews
same as --media-type='message/rfc822'
--mhonarc
same as --media-type='text/html; x-type=mhonarc'
-F, --target-list=FILE
load FILE which contains a list of target files.
--allow=PATTERN
set PATTERN for file names which should be allowed.
--deny=PATTERN
set PATTERN for file names which should be denied.
--exclude=PATTERN
set PATTERN for pathnames which should be excluded.
-e, --robots
exclude HTML files containing <meta name="ROBOTS" content="NOINDEX">
-M, --meta
handle HTML meta tags for field-specified search.
-r, --replace=CODE
set CODE for replacing URI.
--html-split
split an HTML file with <a name="..."> anchors.
--mtime=NUM
limit by mtime just like find(1)'s -mtime option. e.g., -50 for recent 50 days, +50 for older than 50.
Morphological Analysis:
-b, --use-mecab
use MeCab for analyzing Japanese.
-c, --use-chasen
use ChaSen for analyzing Japanese.
-k, --use-kakasi
use KAKASI for analyzing Japanese.
-m, --use-chasen-noun
use ChaSen for extracting only nouns.
-L, --indexing-lang=LANG index with language specific processing.
Text Operations:
-E, --no-edge-symbol
remove symbols on edge of word.
-G, --no-okurigana
remove Okurigana in word.
-H, --no-hiragana
ignore words consist of Hiragana only.
-K, --no-symbol
remove symbols.
--decode-base64
decode base64 bodies within multipart entities.
Summarization:
-U, --no-encode-uri
do not encode URI.
-x, --no-heading-summary do not make summary with HTML's headings.
Index Construction:
--update=INDEX
set INDEX for updating.
-z, --check-filesize
detect file size changed.
-Y, --no-delete
do not detect removed documents.
-Z, --no-update
do not detect update and deleted documents.
Miscellaneous:
-s, --checkpoint
turn on the checkpoint mechanism.
-C, --show-config
show the current configuration.
-f, --config=FILE
use FILE as a config file.
-I, --include=FILE
include your customization FILE.
-O, --output-dir=DIR
set DIR to output the index.
-T, --template-dir=DIR
set DIR having NMZ.{head,foot,body}.*.
-q, --quiet
suppress status messages during execution.
-v, --version
show the version of namazu and exit.
-V, --verbose
be verbose.
-d, --debug
be debug mode.
--help show this help and exit.
--norc do not read the personal initialization files.
-- Terminate option list.
REPORTING BUGS
Report bugs to <http://www.namazu.org/trac-namazu/trac.cgi> or <bug-namazu@namazu.org>.
COPYRIGHT
Copyright (C) 1997-1999 Satoru Takabayashi All rights reserved.
Copyright (C) 2000-2009 Namazu Project All rights reserved.
This is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER-
CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
mknmz of Namazu 2.0.21 July 2011 MKNMZ(1)