This is the full file name I get when I do ls -lt from my current directory.
EXPORT_v1x0_20120811_11_T_065800_070000.dat.gz
File names also consist of date as well. In the above file date is 20120811.
So I am trying to delete all the files which starts with EXPORT_v1x0 and whose date is less than 20120825.
I am using the below script from the command line to delete the files
find . \( ! -name . -prune \) -type f -name "EXPORT_v1x0*" | awk -F'_' '$3<20120825' | xargs rm
But whenever I use the above command to delete the files, I always get this below exception.
rm: ./EXPORT_v1x0_20120811_11_T_065800_070000.dat.gz not removed: Disc quota exceeded
Can anyone tell me what does this exception means? And how to overcome this problem?
I am running SunOS.
bash-3.00$ uname -a
SunOS lvsaishdc3in0001 5.10 Generic_142901-02 i86pc i386 i86pc
Yoda
2
Check this thread and try the solution provided by jim mcnamara
Thanks for the help But should I add that truncation part in my script here? That's confusing me a lot.
Yoda
4
> $fname
is the truncation part. Just modify the script to read from your find
command:
find . \( ! -name . -prune \) -type f -name "EXPORT_v1x0*" | awk -F'_' '$3<20120825' | while read fname
do
> "$fname"
rm "$fname"
done
How about this, I do need the date part as well here-
find . \( ! -name . -prune \) -type f -name "EXPORT_v1x0*" | awk -F'_' '$3<20120825' | while read fname
do
> "$fname"
rm "$fname"
done
Yoda
6
Yes, I edited my post to include that as well. I hope this helps.
rm: ./EXPORT_v1x0_20120811_11_T_065800_070000.dat.gz not removed: Disc quota exceeded
Still same exception I got. Any other thoughts.
Yoda
8
What happened with truncation? Is size set to zero for this file?