in reply to RE: search disk and prompt for deletion of files larger than a certain size
in thread search disk and prompt for deletion of files larger than a certain size

Still suffering from the "whitespace in the directory name" problems, of course.

-- Randal L. Schwartz, Perl hacker

  • Comment on RE: RE: search disk and prompt for deletion of files larger than a certain size

Replies are listed 'Best First'.
RE: RE: RE: search disk and prompt for deletion of files larger than a certain size
by redcloud (Parson) on Oct 02, 2000 at 06:56 UTC
    The GNU versions can handle the "whitespace in the directory name" problems: find / -name '*.gz' -size +1000k -print0 | xargs -0 rm -i or find / -name '*.gz' -size +1000k -print0 | xargs -0 -p -n 1 rm Note the -print0 switch on the find and the -0 switch on the xargs command.
RE: RE: RE: search disk and prompt for deletion of files larger than a certain size
by fundflow (Chaplain) on Oct 02, 2000 at 16:43 UTC
    Since you brought this point up more than once, i'm just wondering where are typical settings where you see spaces in filenames?

    (it is so rare for me that i usually just don't think about it)
    thanks,

    ff
      That is a classic stupid user trick. :-)

      Honestly, programmers tend to be aware in their gut of the problems you could get into with spaces and Don't Do That. But end users blithely type "My Personal Stuff" into the GUI and then wonder much later why something broke.

      Oh, and Microsoft does it as well. For example "Program Files". "My Computer".

      I have seen them be burned by it as well. I forget which vesion of IE and Excel, but if you were on a computer where temporary internet files went into a path with spaces (for instance, c:\\WINNT\Temporary Internet Files) and you passed them a .csv file from a CGI script with arguments (a url like http://yoursite/yourpath/some.cgi/nicename.csv?month=200004) then it would break the path to the temporary downloaded file into components and try to launch Excel multiple times, one per component.

      Oops.

      This is why real data structures are safer than constantly parsing and reparsing text like shell scripts do.

      It takes only one to ruin your day:
      $ mkdir -p "/tmp/fool /etc" $ touch "/tmp/fool /etc/passwd"
      Then kick back and wait for the nightly root cronjob to clean up /tmp.

      -- Randal L. Schwartz, Perl hacker