01-16-2008
with small litle change... from frank_rizzo
find /path/to/blah -type d -mtime +180 -print0 | xargs -0 rm -rf
I hope this works better and reliable in situations like a huge no.of directories - where usually commands fail wih 'arguments too long'
-ilan
Last edited by ilan; 01-16-2008 at 01:09 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
I want to delete all files in a directory which are older than a given date.
I thought of doing it by creating a file by the required date by using touch command. And then i would use find command on that file and try to find files older than that.
I searched the man and found a... (3 Replies)
Discussion started by: rajugp1
3 Replies
2. Solaris
Hi,
I am using Solaris Box, I need to delete file(cookies.html) from the path(/usr/temp) which are older than 24 hours(I want in hours, not in days)
Can u provide the command for the above query (7 Replies)
Discussion started by: mazhar803
7 Replies
3. Shell Programming and Scripting
Hi,
I need a script to delete files that are 30 days older and also the file name should contain aa or ab or ac as substring...
Regards,
Dolly.... (3 Replies)
Discussion started by: moon_friend
3 Replies
4. Shell Programming and Scripting
Hi Guys,
I want to delete folder/files older than 7 days. Im using the command below.
find /test/test1 -mtime +7 -print0 | xargs -0 rm -Rf /test/test1/*
which works ok, but it deletes the test1 folder as well which i dont want. The test1 folder will have a list of sub-folders which in... (4 Replies)
Discussion started by: shezam
4 Replies
5. Shell Programming and Scripting
Hello all,
Here's the deal...I have one directory with many subdirs and files.
What I want to find out is who is keeping old files and directories...say files and dirs that they didn't use since a number of n days, only one level under the initial dir. Output to a file.
A script for... (5 Replies)
Discussion started by: ejianu
5 Replies
6. UNIX for Advanced & Expert Users
hi
This should be easy but i'm obviously missing something obvious. :)
I'm looking to delete files from yesterday and older of extension .txt and there a range of subfolders with these files in them. The command runs but doesn't delete anything. SUSE 10.
find /testfolder -maxdepth 2 -type f... (6 Replies)
Discussion started by: cmap
6 Replies
7. Shell Programming and Scripting
Hi Guys,
I am new to unix
I am looking for a script to delete files older than 7 days but i also want to exclude certain directories (like arch,log .....) and also some files with extensions
( like .ksh, .ch, ..............)
Thanks (1 Reply)
Discussion started by: MAYAMAYA0451
1 Replies
8. Shell Programming and Scripting
Hi All,
I am using the below script to find all the files in a folder which are older than 6 hours and delete all those files, but some how I am not getting the required output.
find $HOME/Log -type f -name "*.log" -amin +360 -exec rm *.* {} \
can any one please check and let me know... (13 Replies)
Discussion started by: subhasri_2020
13 Replies
9. Shell Programming and Scripting
How to Deleting Files Older than 1 hours.
Base on SunOS.
this file gen every 1 min.
-rw-r--r-- 1 nobody nobody 4960 Jan 27 02:02 23_201301270201.log
-rw-r--r-- 1 nobody amudu 2325 Jan 27 02:03 33_201301270202.log
-rw-r--r-- 1 nobody amudu 3255 Jan 27 02:03... (2 Replies)
Discussion started by: ooilinlove
2 Replies
10. Shell Programming and Scripting
Hi,
I need to delete *.bad files which are 1 week old. How can I achieve that. I tried doing through below script but it deletes all the files.
find ./ -mtime +7 -exec rm *.bad {} \;
The below one works but i want to delete only files with .bad extension
find . -mtime +7 | xargs rm (2 Replies)
Discussion started by: Gangadhar Reddy
2 Replies
LEARN ABOUT DEBIAN
metastore
metastore(1) General Commands Manual metastore(1)
NAME
metastore - stores and restores filesystem metadata
SYNOPSIS
metastore ACTION [OPTION...] [PATH...]
DESCRIPTION
Stores or restores metadata (owner, group, permissions, xattrs and optionally mtime) for a filesystem tree. This can be used to preserve
the metadata in situations where it is usually not stored (git and tar for example) or as a tripwire like mechanism to detect any changes
to metadata. Note that e.g. SELinux stores its labels in xattrs so care should be taken when applying stored metadata to make sure that
system security is not compromised.
ACTIONS
-c, --compare
Shows the difference between the stored and real metadata.
-s, --save
Saves the current metadata to ./.metadata or to the specified file (see --file option below).
-a, --apply
Attempts to apply the stored metadata to the file system.
-h, --help
Prints a help message and exits.
OPTIONS
-v, --verbose
Causes metastore to print more verbose messages. Can be repeated more than once for even more verbosity.
-q, --quiet
Causes metastore to print less verbose messages. Can be repeated more than once for even less verbosity.
-m, --mtime
Causes metastore to also take mtime into account for the compare or apply actions.
-e, --empty-dirs
Also attempts to recreate missing empty directories. May be useful where empty directories are not tracked (e.g. by git or cvs).
Only works in combination with the apply option. This is currently an experimental feature.
-f <file>, --file <file>
Causes the metadata to be saved, read from the specified file rather than ./.metadata.
PATHS
If no path is specified, metastore will use the current directory as the basis for the actions. This is the recommended way of executing
metastore. Alternatively, one or more paths can be specified and they will each be examined. Later invocations should be made using the
exact same paths to ensure that the stored metadata is interpreted correctly.
AUTHOR
Written by David Hardeman <david@hardeman.nu>
May 2007 metastore(1)