I am trying to cleanup a directory with around 4000 files, and using the below command to delete all .gz files older than 60 days, I am having the same issue of arguments being too long. is there a way i can use the same command to do what I intend to do.
find /opt/et/logs/Archive/*.log.*.gz -type f -mtime +60 -exec rm {} \;
Hi,
I have more than 1000 directories under one directory (lets says under /home/).
Sub directories are like A1 to A100,B1 to B100 etc..
Here my problem is I need to find the files older than 10 days in the directories which starts with A*.
I tried some thing like this which is not working.
Code:
find .
Hi,
I would like to list all files, older than 7 days, in a directory, but exclude all subdirectories in the find command. If I use find . -type f -mtime +7 all files in the subdirs are also included. How can I exclude them?
Regards,
JW
Hi ,
I am a newbie!!!
I want to develop a script for deleting files older than x days from multiple paths. Now I could reach upto this piece of code which deletes files older than x days from a particular path. How do I enhance it to have an input from a .txt file or a .dat file?
Hi All
I want to remove the files with name like data*.csv from the directory older than 10 days.
If there is no files exists to remove older than 10 days, It should not do anything.
Thanks
Jo
Hello
I have a large number of files in a directory, when I issue either one of these statements to get a list of files older than 90 days sorted by time descending I do not get the expected results:
Code:
find . -type f -mtime +90 | xargs ls -ltr
find .
Chance is that there will be empty files (zero byte files) and empty directories (that doesn’t contain any files) in your system. In this article, I will show you how to locate these empty directories and files and delete them.
The command you can use is the "find" command. To find empty directories in the current directory, you use the option -empty:
find .
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
Code:
cd /hyperion/logs/essbase/app
Check to find all the Essbase Application logs
Code:
find .
Hio, So I have a crontab delete of older files setup. This script works fine if I run them by each individual directory.
Problem is there are so many thousands of files and hundreds of directories and sub directories that I need to recursively have it go through and delete files by directory instead of doing the "\*\*\" method.