X-Git-Url: http://git.pippins.net/embedvideo/.git/static/gitweb.js?a=blobdiff_plain;f=move_videos_from_watchdir;h=864d33e1c8265869001dd8202fc1ce33f37e0c2e;hb=aea4af9869a2086c5085afb34a1bd790940c8b7d;hp=364ade6575180ba5644e87ada1a9ba7db8f0238d;hpb=26e29c4b2a1ba5181b379a64c86f4d521d77dcf7;p=videoscripts%2F.git diff --git a/move_videos_from_watchdir b/move_videos_from_watchdir index 364ade6..864d33e 100755 --- a/move_videos_from_watchdir +++ b/move_videos_from_watchdir @@ -85,7 +85,7 @@ foreach $watchpath (split(';', $watchpathname)) { } # Make sure we have a unique dstfile - if(-f "$dstfile") { + if($overwrite_dest == 0 && -f "$dstfile") { $video_ext = $srcfile; $video_ext =~ s/.*\.(\S+)$/$1/; $suffix = 0; @@ -102,18 +102,22 @@ foreach $watchpath (split(';', $watchpathname)) { if(!defined $opt_t) { # Make sure the dstfile doesn't exist, if it does, add a unique number to the end - if(! -f "$dstfile") { - $errno=system("mv \"$srcdir/$srcfile\" \"$dstfile\" 2>/dev/null"); - if($errno) { print "-E- Error moving srcfile to dstfile: $srcdir/$srcfile -> $dstfile\n"; next; } - } else { - print "-E- Unable to mv $srcdir/$srcfile -> $dstfile because it already exists\n"; - } + #if(! -f "$dstfile") { + $errno=system("mv \"$srcdir/$srcfile\" \"$dstfile\" 2>/dev/null"); + if($errno) { print "-E- Error moving srcfile to dstfile: $srcdir/$srcfile -> $dstfile\n"; next; } + #} else { + # print "-E- Unable to mv $srcdir/$srcfile -> $dstfile because it already exists\n"; + #} # Fix the permissions system("chown $owner \"$dstfile\""); system("chgrp $group \"$dstfile\""); system("chmod $mode \"$dstfile\""); } } + + # Update nextcloud file cache so it knows what files we have moved + $watchpath =~ s/$nextcloudbase//g; + system("$occ files:scan --path \"$watchpath\" > /dev/null"); } $pidfile->remove();