siom79 / jdrivesync

jdrivesync is a simple command line tool that synchronizes a local file system structure to your Google Drive (and back)

Home Page:https://siom79.github.io/jdrivesync/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to empty a cloud folder properly

MauroSteel opened this issue · comments

Working on a script in a case where multiple users upload files to an inbox-folder on Google Drive. Script is downloading, doing some stuff, moving & renaming according some scripting and uploading renamed files to different folders. Just working fine ;-)

At some point, i want to clear the inbox. However, in the meantime the script is running, user x can have added a new file to the inbox.

How can i prevent that new files will be removed? Or did i miss an argument?

Now i've (inbox is cloud-folder, down is local folder):

## download to local folder
/opt/jdrivesync/jdrivesync.sh --down -r "$inbox" -l "$down" 

{do stuff}

## empty local folder
rm -rf "$down"/*
rm -rf "$down"/.[a-z]*
## upload empty folder = empty cloud folder
/opt/jdrivesync/jdrivesync.sh --up -r "$inbox" -l "$down" 

Have you tried --no-delete?