Register
It is currently Fri Dec 19, 2014 12:45 am

Fun with for loops! Need help.


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Tue Sep 06, 2011 11:18 am   

Joined: Tue Sep 06, 2011 11:08 am
Posts: 1
So I'm trying to write a script that will clean up a folder full of all kinds of java stuff and throw certain things in the trash. Right now I have two loops that look like

for txt in $folder/*.ctxt; do
mv $txt $folder/"trashes"
done

for txt in $folder/*.class; do
mv $txt $folder/"trashes"
done

Is there a way I can write these two seperate for loops as just one for loop that will filter for both file types?


Top
 Profile  
 PostPosted: Tue Sep 06, 2011 11:46 am   
User avatar

Joined: Sun Jun 27, 2010 12:57 am
Posts: 192
Code:
for txt in "$folder"/*.{ctxt,class}; do
  mv "$txt" "$folder/trashes"
done


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP