View previous topic :: View next topic |
Author |
Message |
syadnom Guru
Joined: 09 May 2002 Posts: 531
|
Posted: Mon Oct 27, 2003 11:19 pm Post subject: auto file links with find command |
|
|
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 |
|
|
k9 Apprentice
Joined: 28 Sep 2003 Posts: 160 Location: Salt Lake City, USA
|
Posted: Tue Oct 28, 2003 12:36 am Post subject: |
|
|
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 |
|
|
|