06-13-2005
Quote:
Originally Posted by cbismuth
I need to find all the files which not end by ".log" and which have been created for 45 days.
After getting the file list, I would like to use the shred command.
Quote:
Originally Posted by zazzybob
find / ! -name "*.log" -mtime 45 | xargs shred -fuvz
EDIT; if running this as root, and some important system files were modified 45 days ago, you are staring into the eyes of doom with a command like that.
Do a
find / ! -name "*.log" -mtime 45 -print
to see the output before adding the "destructive" pipe through to xargs shred.
I think it's actually worse than you think, ZB. Since the OP used the the past perfect tense, I would read that as:
... -mtime +44 ... # (I could not bring myself to type such a dangerous command in its entirety)
Destroy all files older than 45 days except for log files and a few newer files.
I can believe an attempt to destroy all files, but trying to leave stuff behind is weird. In any event shredding /dev/mem or /dev/kmem will panic the system for sure. But I doubt the command will get that far. We need some clarification here.
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi
I am using
#!/bin/sh
DATE="$1"
FILE="$2"
FLIST=""
for f in $FILE
do
FDATE=$(ls -l $f | awk '{ print $6 }')
if ;then
FLIST="$FLIST $f"
fi
done
&& echo $FLIST || echo "Sorry no files found to match $DATE date."
the below... need correction
whne i execute the above (1 Reply)
Discussion started by: gkrishnag
1 Replies
2. Shell Programming and Scripting
**************************************************
Purpose : find files by date
Condition: olther than | newer than | between _date1 _date2
Date format: 2007/10/28
**************************************************
Please help me
Thanks (1 Reply)
Discussion started by: kani
1 Replies
3. Shell Programming and Scripting
Hi All,
Can i use find command to know given date files? If yes, then please let me know the syntax for the same.
Thanks in advance for your postive responses
Regards,
Bachegowda (3 Replies)
Discussion started by: bache_gowda
3 Replies
4. Shell Programming and Scripting
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
5. Shell Programming and Scripting
Hi, I need to find out list of files which are older than specific date. I am using 'find, and newer' commands but its not giving the correct result.
Can you please help to findout the list of files.
thanks (2 Replies)
Discussion started by: Satyak
2 Replies
6. Shell Programming and Scripting
Hi All,
I am very new to UNIX and I have tried this for a longtime now and unable to crack it....
There is a file that is continuously updating. I need to search for the string and find the date @ which it updated every day.....
eg:
String is "work started"
The log entry is as below:
... (1 Reply)
Discussion started by: Nithz
1 Replies
7. UNIX for Dummies Questions & Answers
Hi all,
I am a beginner and I was hoping you can help me out.
I am doing some PDF cleanup and I am looking for a command to search for all PDFs in a certain folder that are older than 2008 for example.
This is what I have so far:
find ./ -mtime +500 -name '*.pdf' >/test/results.txt
... (13 Replies)
Discussion started by: SyphaX
13 Replies
8. Shell Programming and Scripting
I'm having problems with my bash script. I would like to find a file matching today's date in the filename, i.e. my_file_20120902.txt and then move it to a different directory, i.e. /tmp. Thanks. (1 Reply)
Discussion started by: jamesi
1 Replies
9. UNIX for Advanced & Expert Users
Hi All,
I need to find all files other than first two files dates & last file date for month and month/year wise list.
lets say there are following files in directory
Mar 19 2012 c.txt
Mar 19 2012 cc.txt
Mar 21 2012 d.txt
Mar 22 2012 f.txt
Mar 24 2012 h.txt
Mar 25 2012 w.txt
Feb 12... (16 Replies)
Discussion started by: Makarand Dodmis
16 Replies
10. UNIX for Dummies Questions & Answers
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
SHRED(1) User Commands SHRED(1)
NAME
shred - overwrite a file to hide its contents, and optionally delete it
SYNOPSIS
shred [OPTION]... FILE...
DESCRIPTION
Overwrite the specified FILE(s) repeatedly, in order to make it harder for even very expensive hardware probing to recover the data.
If FILE is -, shred standard output.
Mandatory arguments to long options are mandatory for short options too.
-f, --force
change permissions to allow writing if necessary
-n, --iterations=N
overwrite N times instead of the default (3)
--random-source=FILE
get random bytes from FILE
-s, --size=N
shred this many bytes (suffixes like K, M, G accepted)
-u truncate and remove file after overwriting
--remove[=HOW]
like -u but give control on HOW to delete; See below
-v, --verbose
show progress
-x, --exact
do not round file sizes up to the next full block;
this is the default for non-regular files
-z, --zero
add a final overwrite with zeros to hide shredding
--help display this help and exit
--version
output version information and exit
Delete FILE(s) if --remove (-u) is specified. The default is not to remove the files because it is common to operate on device files like
/dev/hda, and those files usually should not be removed. The optional HOW parameter indicates how to remove a directory entry: 'unlink' =>
use a standard unlink call. 'wipe' => also first obfuscate bytes in the name. 'wipesync' => also sync each obfuscated byte to disk. The
default mode is 'wipesync', but note it can be expensive.
CAUTION: Note that shred relies on a very important assumption: that the file system overwrites data in place. This is the traditional way
to do things, but many modern file system designs do not satisfy this assumption. The following are examples of file systems on which
shred is not effective, or is not guaranteed to be effective in all file system modes:
* log-structured or journaled file systems, such as those supplied with AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.)
* file systems that write redundant data and carry on even if some writes fail, such as RAID-based file systems
* file systems that make snapshots, such as Network Appliance's NFS server
* file systems that cache in temporary locations, such as NFS version 3 clients
* compressed file systems
In the case of ext3 file systems, the above disclaimer applies (and shred is thus of limited effectiveness) only in data=journal mode,
which journals file data in addition to just metadata. In both the data=ordered (default) and data=writeback modes, shred works as usual.
Ext3 journaling modes can be changed by adding the data=something option to the mount options for a particular file system in the
/etc/fstab file, as documented in the mount man page (man mount).
In addition, file system backups and remote mirrors may contain copies of the file that cannot be removed, and that will allow a shredded
file to be recovered later.
AUTHOR
Written by Colin Plumb.
REPORTING BUGS
GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
Report shred translation bugs to <http://translationproject.org/team/>
COPYRIGHT
Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
SEE ALSO
Full documentation at: <http://www.gnu.org/software/coreutils/shred>
or available locally via: info '(coreutils) shred invocation'
GNU coreutils 8.28 January 2018 SHRED(1)