copy - Bash copying files with variables -


new bash scripting, i'm writing script copy tv shows accross download folder archive folder.

so far have this:

find `*`show1`*`.avi |  cp \"" $0 "\" "/mnt/main/data/tv/show1"  find `*`show2`*`.avi |  cp \"" $0 "\" "/mnt/main/data/tv/show2" 

i understand not best method, skills of bash quite limited.

i need know how can copy found file, or nothing if doesnt find matching (this cron script). eg.

find `*`show1`*`.avi |  cp "show1.hello.world.xvid.avi" "/mnt/main/data/tv/show1"  find `*`show2`*`.avi |  cp "show2.foo.bar.xvid.avi" "/mnt/main/data/tv/show2"  find `*`show3`*`.avi |  cp "null (nothing found)" "/mnt/main/data/tv/show3" 

thanks!

edit: solved http://pastebin.com/anlihr86

find . -name "*show1*" -exec cp {} /mnt/main/data/tv/show1 \; 

(replace . directory want files into)


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -