AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only
  • 1.  Delete files with zero size

    Posted Wed June 26, 2013 03:14 AM

    Originally posted by: Nikolay_Mitev


     

    Hello,
     
    Can you advise me how to delete a lot of files from the 0 byte,
    but the amount is huge maybe a few million. (the machine is old)
    It can not use the (ls, find, xargs), these commands can not read these files (loop a).
     

    Best regards,

    Nikolay



  • 2.  Re: Delete files with zero size

    Posted Wed June 26, 2013 11:40 AM

    Originally posted by: GarlandJoseph


    Please be more specific.  What do you mean by "loop a".   Are you talking about an iso/loop device? Why can't you use find...are you trying to delete files in one task by piping and exceeding the shell size for arguments?



  • 3.  Re: Delete files with zero size

    Posted Mon July 01, 2013 05:31 AM

    Originally posted by: Nikolay_Mitev


     

    Thanks Joseph,
     
    I'll try to do a cycle in a script that delete 5 files then pause and then again 5 files, because any other experience end with a freezing process.

     

    Best regards,

    Nikolay



  • 4.  Re: Delete files with zero size

    Posted Fri June 28, 2013 04:37 AM

    Originally posted by: teletype


    As stated.. more info would be welcome.

    Are those files in use?

    If you have al lot of 0 byte files.. Is your filesystem corrupt?

    Whats wrong with: (apart from that it does not check)?

     find . -type f -size 0 | xargs rm -f



  • 5.  Re: Delete files with zero size

    Posted Mon July 01, 2013 05:39 AM

    Originally posted by: Nikolay_Mitev


    Thanks teletype,

    Suspicious to have so many files with zero value will examine in detail the system.

    Best regards,

    Nikolay

     



  • 6.  Re: Delete files with zero size

    Posted Fri July 12, 2013 01:05 PM

    Originally posted by: GarlandJoseph


    might need  -n1 on the xargs command if shell argument size is exceeded



  • 7.  Re: Delete files with zero size

    Posted Tue October 29, 2013 01:51 PM

    Originally posted by: efabianb


    Hello Nikolay.

    You can also use the find command and delete files by date.

    Regards.

     



  • 8.  Re: Delete files with zero size

    Posted Tue November 05, 2013 05:45 AM

    Originally posted by: Nikolay_Mitev


    Hello Efabian, 

    Thanks for the advice

    Best regards,



  • 9.  Re: Delete files with zero size

    Posted Mon March 24, 2014 03:30 PM

    Originally posted by: rammaghenthar


    you can use this command

    du -xak <> | sort -rn | head -20 to first 20 big files as per size.

     

    by typing  Ctrl and Alt similtaneously and select all files which need to select 

    then assign all file in to letter a='paste all files here'

    then using the script

    for i in $a

    do 

    rm $i

    done 

    before you echo $a will show file names need to be deleted.