Hi , Thanks to all those who replied.Special thanks to Dave Mitchell who provided the solution first.The solution by Jeff Woolsey also works,thanks for reply. Sanjeev Original Problem: > Hi, > I am trying to delete files with strange names like quotes ,spaces or backslashes. > > find /dir -name '*.inactive' -print | xargs rm > > This command fails when xargs encounters a control character or a quote. Solution from Dave Mitchell: If you have Perl installed, the following should do the trick (as long as the filename doesnt have a \n it it). find . -name '*.inactive' -print | perl -ne 'chomp; unlink' or if you want error reportting too: find . -name '*.inactive' -print | \ perl -ne 'chomp; unlink or warn "Failed to delete $_: $!\n"' Solution from Jeff Woolsey: That's a problem with xargs. The interface does leave a little to be desired, though it's better than the shell ( rm *.inactive with special characters). Try find2perl with the same arguments (not the pipe, though), and edit the resulting perl code to do what you want. Or use somethig like this: #! /usr/local/bin/perl ### xargs rm without the globbing. # # Hmm. It's not this simple. @_ = <>; chop(@_); unlink @_; exit 0; Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at http://www.eudoramail.com _______________________________________________ sunmanagers mailing list sunmanagers@sunmanagers.org http://www.sunmanagers.org/mailman/listinfo/sunmanagersReceived on Sat May 4 22:14:03 2002
This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:42 EST