start page | rating of books | rating of authors | reviews | copyrights

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 23.4 Answer "Yes" or "No" Forever with yes Chapter 23
Removing Files
Next: 23.6 A Faster Way to Remove Files Interactively
 

23.5 Remove Some, Leave Some

Most people use rm -i ( 21.11 ) for safety: so they're always asked for confirmation before removing a particular file. Mike Loukides told me about another way he uses rm -i . When he has several files to remove, but the wildcards ( 1.16 ) would be too painful to type with a plain rm , Mike gives rm -i a bigger list of filenames and answers "n" to filenames he doesn't want deleted. For instance:

% 

ls

 aberrant    abhorred    abnormal     abominate   acerbic aberrate    abhorrent   abominable   absurd      acrimonious     ... % 

rm -i ab*

 rm: remove aberrant (y/n)? 

y

 rm: remove aberrate (y/n)? 

n

 rm: remove abhorred (y/n)? 

y

 rm: remove abhorrent (y/n)? 

n

     ...

- JP


Previous: 23.4 Answer "Yes" or "No" Forever with yes UNIX Power Tools Next: 23.6 A Faster Way to Remove Files Interactively
23.4 Answer "Yes" or "No" Forever with yes Book Index 23.6 A Faster Way to Remove Files Interactively

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System