Script to move only files not being used using fuser.
New to these forums but figured this would be a good jump off point for my question.
I'm trying to create a script that will check to see if all files in a folder are in use. If they are in use, ignore it; if they're not in use, change their ownership and move them to another directory.
So far this is what I have.
if ! fuser $FILESRC/folder/*.*
chown user:group $FILESRC/folder/*.*
mv $FILESRC/folder/*.* $FILEDST/folder
When executing the script it will tell me that there's an open file but won't proceed with the rest of the commands. Can anyone help with what's wrong in my script?