$srcfile = $file;
$dstfile = "$dstpathname/$file";
+ # Make sure srcdir is group writable
+ if(not -w "$srcdir") {
+ print "-W- srcdir is not group writable, can't move videos out of it: $srcdir\n";
+ next;
+ }
+
# 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;
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();