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 .
I'm writing a bash script to do some work on a directory that contains many (100,000+) sub-directories. Is there a predefined limit to how many arguments you can pass to a for loop such as the following?
for dir in $(find . -type d)
do
# My code
done
I'm worried the script will bork if the find command returns too many directories.
how do i remove sub directories of a directory and all files which are older than 7 days by a single command in AIX. pls help me.
I am using command as
#find /gpfs1/home/vinod/hpc/ -depth -type d -mtime +7 -exec rm -rf {} \;
so i want to delete all sub directories and all files from the hpc dir. which are older than 7 days.
I create directories very often, scattered over my home directory, and I find it very hard to locate and delete them.
I want any alias/function/script to find/locate and delete all empty directories in my home directory.
So i have directories that store logs, 1 directorie for each day, with the name like this :
2012_07_01/
2012_07_02/
and for each directorie we have the logs, inside them lives the logs for that day, and every log have this name pattern :
sensor1_log_from_2012_07_01_10_:_30_to_2012_07_01_10_:_50
and every file have 100 mb
now that the introduction about the system is done i can tell the
I'm unsure what's going on here:
I've got a backup script which runs fine under root. It produces a >300kb database dump in the proper directory.
When running it as a cron job with exactly the same command however, an empty gzip file appears with nothing in it.
The cron log shows no error, just that the command has been run.
This is the script:
#!
I need a script that counts the files in a directory (and sub). I've taken the followed script, and changed it to my need.
It works like it should, except for folders with space characters.
I'm working on a project that requires me to compress then relocate directories to a different location based on their last date of modification. After running the script I check to see if it worked, and upon unzipping the tar.gz using [tar -zxvf] I created everything that should be there is.
How to list the directories that are not acessed for more than 500 days?
i used find in the following way
find . -type d -atime +500 -exec du -sh {} \;
but it is listing all the sub direcories of the parent directories which satisfy above condiion.I would like to get just name of the parent directories(not subdirectories).their last acess time with size.
Thanks.