2

I would like to find all .mkv files in my download directory and create a hard link to them in my /movies/ directory.

Here’s what I have so far:

for i in `find /download/ -name *.mkv`; do ln "$i" /movies/; done

Which almost works: I receive a bunch of hard links to partial file names. That is, instead of a hard link to say The Best Movie Ever.mkv I receive four hard links, one to The one to Best one to Movie and one to Ever.mkv

Any suggestions?

Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
curios
  • 350
  • 1
  • 3
  • 13
  • Look at this answer. It’s about renaming misnamed files, but the core `find` logic should work for you. http://superuser.com/a/847795/167207 – Giacomo1968 Dec 07 '14 at 08:11

1 Answers1

2

Try this way:

find /download/ -name *.mkv -exec ln {} /movies/ \;
jherran
  • 1,879
  • 3
  • 20
  • 28