Topic
  • 8 replies
  • Latest Post - ‏2014-03-24T19:29:56Z by rammaghenthar
Nikolay_Mitev
Nikolay_Mitev
7 Posts

Pinned topic Delete files with zero size

‏2013-06-26T07:14:06Z |

 

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

  • GarlandJoseph
    GarlandJoseph
    167 Posts

    Re: Delete files with zero size

    ‏2013-06-26T15:39:57Z  

    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?

  • teletype
    teletype
    27 Posts

    Re: Delete files with zero size

    ‏2013-06-28T08:37:23Z  

    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

  • Nikolay_Mitev
    Nikolay_Mitev
    7 Posts

    Re: Delete files with zero size

    ‏2013-07-01T09:30:59Z  

    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?

     

    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

  • Nikolay_Mitev
    Nikolay_Mitev
    7 Posts

    Re: Delete files with zero size

    ‏2013-07-01T09:38:41Z  
    • teletype
    • ‏2013-06-28T08:37:23Z

    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

    Thanks teletype,

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

    Best regards,

    Nikolay

     

    Updated on 2013-07-01T09:39:06Z at 2013-07-01T09:39:06Z by Nikolay_Mitev
  • GarlandJoseph
    GarlandJoseph
    167 Posts

    Re: Delete files with zero size

    ‏2013-07-12T17:05:16Z  
    • teletype
    • ‏2013-06-28T08:37:23Z

    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

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

  • efabian
    efabian
    4 Posts

    Re: Delete files with zero size

    ‏2013-10-29T17:51:28Z  

    Hello Nikolay.

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

    Regards.

     

  • Nikolay_Mitev
    Nikolay_Mitev
    7 Posts

    Re: Delete files with zero size

    ‏2013-11-05T10:45:21Z  
    • efabian
    • ‏2013-10-29T17:51:28Z

    Hello Nikolay.

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

    Regards.

     

    Hello Efabian, 

    Thanks for the advice

    Best regards,

  • rammaghenthar
    rammaghenthar
    2 Posts

    Re: Delete files with zero size

    ‏2014-03-24T19:29:56Z  

    Hello Efabian, 

    Thanks for the advice

    Best regards,

    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.