mirror of
https://github.com/Febbweiss/rclone_script.git
synced 2026-03-04 22:25:36 +00:00
added function to delete file from remote:/${remotebasedir}
This commit is contained in:
@@ -287,6 +287,34 @@ function uploadSaves ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function deleteFileFromRemote ()
|
||||||
|
# deletes a file from the remote
|
||||||
|
# INPUT
|
||||||
|
# $1 > relative filepath incl. name and extension to the local savepath
|
||||||
|
# RETURN
|
||||||
|
# 0 > file deteted successfully
|
||||||
|
# 1 > connection not available
|
||||||
|
# 2 > file could not be deleted
|
||||||
|
{
|
||||||
|
fileToDelete="$1"
|
||||||
|
|
||||||
|
getAvailableConnection
|
||||||
|
availableConnection=$?
|
||||||
|
if [[ ${availableConnection} -gt ${neededConnection} ]]
|
||||||
|
then
|
||||||
|
log "ERROR" "Needed Connection not available. Needed ${neededConnection}, available ${availableConnection}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
rclone delete retropie:${remotebasedir}/${fileToDelete} 2>&1 >> ${logfile}
|
||||||
|
if [[ $? -eq 0 ]]
|
||||||
|
then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
########
|
########
|
||||||
# MAIN #
|
# MAIN #
|
||||||
########
|
########
|
||||||
@@ -308,3 +336,8 @@ then
|
|||||||
getTypeOfRemote
|
getTypeOfRemote
|
||||||
downloadSaves
|
downloadSaves
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "${direction}" == "delete" ]
|
||||||
|
then
|
||||||
|
deleteFileFromRemote "${2}"
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user