Manufacturing Information Solutions Forum Index Manufacturing Information Solutions
Your Place for Support and Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Delete files

 
Post new topic   Reply to topic    Manufacturing Information Solutions Forum Index -> Linux
View previous topic :: View next topic  
Author Message
mistux
Site Admin


Joined: 25 Jun 2004
Posts: 1042
Location: South Bend, Indiana USA

PostPosted: Thu Mar 27, 2008 2:05 pm    Post subject: Delete files Reply with quote

List files with extension .doc in tesdir1 + subdirs:
Quote:
ix:~$ find ./testdir1 -name "*.doc" -exec ls {} \;
./testdir1/testdir2/file2.doc
./testdir1/file1.doc


Remove those files:
Quote:
nix:~$ find ./testdir1 -name "*.doc" -exec rm -i {} \;
rm: remove regular empty file `./testdir1/testdir2/file2.doc'? y
rm: remove regular empty file `./testdir1/file1.doc'? y

the -i switch to rm makes it ask for confirmation; without it, it would just delete;

rm -r is apparently only to remove directories (+ their contents), not individual files within them, that is maybe why the combination -r and *.doc doesn't work
-r, -R, --recursive
remove directories and their contents recursively
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Manufacturing Information Solutions Forum Index -> Linux All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group