I'm having trouble with moving files in a bash script. I've been trying different solutions that I've found here, on the same problem, but can't find anything that works..
my last attempt was adding shopt -s dotglob nullglob but that didn't solve anything..
In this test,
jdir0="/media/sf_Mediaserver3/test22/abbamax.(6th.copy)..kansas.(1999)"
mv -v "$jdir0/*" "$jdir0/subs/" &>> $debuglog
.. and I get:
mv: cannot stat '/media/sf_Mediaserver3/test22/abbamax.(6th.copy)..kansas.(1999)/*': No such file or directory
but, yes, there are!
drwxrwx--- 1 root vboxsf 4096 Aug 22 07:06 ../
-rwxrwx--- 1 root vboxsf 0 Aug 21 17:19 'kallee.(222)..nnn.srt'*
-rwxrwx--- 1 root vboxsf 159363 Aug 21 17:26 'movie.test(2929).ismim.mp4'*
drwxrwx--- 1 root vboxsf 0 Aug 22 07:06 subs/
(the reason the names are really strange is that I before this function is testing to remove invalid chars)
update: Apparently I got intermittent errors, and I've finally after days traced it back to server issue (where the files where stored). Apparently these errors occurred if the server wasn't finished with the save/name change, and the script asked it to do something new. For example renaming file A to B, and then asking it to rename B to C BEFORE the server had executed the first request, which resulted in that the server said: B don't exist, which of course caused an error code.