files of size 0 need to be deleted inside a directory

Hiiii,

I have written a script which takes backup of some log files.
let say the backuplocation is ---

/abc/backuplocation

-rw-r--r-- 1 webmut2 spgroup 0 Jan 27 02:41 ansrpt23994.log
-rw-r--r-- 1 webmut2 spgroup 0 Jan 27 02:41 ansrpt3601.log
-rw-r--r-- 1 webmut2 spgroup 0 Jan 27 02:41 ansrpt3619.log
-rw-r----- 1 webmut2 spgroup 1551 Jan 25 07:13 ansrpt3619.log

after taking the backup i have to delete the files and then touch the files so that it create the file but with size 0 this is required in the script.

suppose the location of the files that need to backed up is---

/namish/logs
-rw-r--r-- 1 webmut2 spgroup 0 Jan 27 02:41 ansrpt23994.log
-rw-r--r-- 1 webmut2 spgroup 0 Jan 27 02:41 ansrpt3601.log
-rw-r--r-- 1 webmut2 spgroup 0 Jan 27 02:41 ansrpt3619.log

My script is working fine for all these but a problem is coming ie when i am touchng the files they are still under the directory /namish/logs,when again i ran the script,my script is picking these files(files with size 0) also and taking the backup.I do not want this because this time the size of the file will be 0.

My script should delete the files from the backuplocation whose size is 0.

The script is -----

l) BackupLocation="$OPTARG"
                if [[ $BackupLocation != *backup ]]; then
                        echo "Appending backup subdirectories"
                        BackupLocation=$BackupLocation/backup
                        mkdir -p $BackupLocation >/dev/null 2>&1
                        if [[ $? != 0 ]];then
                        echo "First Create The Directory And Then Take backup"
                        fi
                        cd $FileLocation
                        pwd
                        cp -R $FilesToDelete $BackupLocation
                        list=$(ls *log*)
                        for files in $list
                        do
                         echo $files >namish1
                          rm -f $files
                          touch $files
                        done
                else
                        mkdir -p $BackupLocation >/dev/null 2>&1
                        cp -R $FilesToDelete $BackupLocation
                        for files in $list
                        do
                          rm -$files
                          touch $files
                        done
                if [[ ! -d $BackupLocation ]]; then
                echo "Unable to make backup directory: $BackupLocation"
                        if [[ $IsCronJob -eq 1 ]]; then
                          SendMiddleTierCleanMail "Middletierclean error message" $mt_clean_errfile
                        fi
                        return $E_INT_MISSING_DIR
                fi
                fi
                l_flag=Y
                Llcron=l
                ;;

how about

ls -l | awk '/ 0 /{print $NF}' | xargs rm -f

of course, you could do a system call within the awk, and forget the xargs.

Dont forget the spaces around the "0"

Try this: This will delete 0 byte files in the current directory

find . -name "*" -size 0b -maxdepth 1 -type f -exec rm {} \;