Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
auto file links with find command
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
syadnom
Guru
Guru


Joined: 09 May 2002
Posts: 531

PostPosted: Mon Oct 27, 2003 11:19 pm    Post subject: auto file links with find command Reply with quote

I'd like to have a cron job that would do a "find /network *avi;*mpg;*mpeg;*mov;*asf;*wmv" and then make links into a /media/videos/ folder.

anyone know if this is possible or realistic?
Back to top
View user's profile Send private message
k9
Apprentice
Apprentice


Joined: 28 Sep 2003
Posts: 160
Location: Salt Lake City, USA

PostPosted: Tue Oct 28, 2003 12:36 am    Post subject: Reply with quote

I'm not sure if I'm following exactly what you are trying to say. If I'm understanding correctly, a quick look at find's man page should get you going in the right direction. Does this help? (Test it carefully before you actually try it on the real files):

Code:

cd /media/videos
rm -f *.avi *.mpg *.mpeg ...
find /network -name \*.avi -o -name \*.mpg -o -name \*.mpeg  ... -exec ln -s {} \;


The rm is needed to remove all of the old links before making the new ones (this could probably be done in other more elegant ways too). You don't need it if you don't care about links going bad. Depending on how much output you want the commands to generate, you might want to append a "> /dev/null" or a " > /dev/null 2>&1 " to the end of the "find" command.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
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