Skip to content

Commit

Permalink
Use remove instead of trash as the operation is not supported on Goog…
Browse files Browse the repository at this point in the history
…le Drive
  • Loading branch information
nivram913 committed Jan 1, 2023
1 parent 4d9a066 commit 341a9d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,3 @@ Usage: ./gdsync.sh <option> [<absolute path to files>]
--force-push Force pushing of specified file(s)
```

Files are never removed from server but a lot of files can be placed in trash folder of Google Drive.

8 changes: 4 additions & 4 deletions gdsync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ save_remote_mtime()
{
local mtime_file

gio trash "$GD_URI/$REMOTE_DIR/mtime.lst"
gio remove "$GD_URI/$REMOTE_DIR/mtime.lst"

mtime_file="$(for file in "${!REMOTE_MTIME[@]}"; do echo "${REMOTE_ENCRYPTED_NAMES["$file"]}$file/${REMOTE_MTIME["$file"]}"; done)"
echo "$mtime_file" | push_file "$REMOTE_DIR/mtime.lst"
Expand Down Expand Up @@ -281,7 +281,7 @@ gds_sync()
gio set "$file" -t stringv metadata::emblems emblem-colors-green
elif test "${LOCAL_MTIME["$file"]}" -gt "${REMOTE_MTIME["$file"]}"
then
gio trash "$GD_URI/$REMOTE_DIR/${REMOTE_ENCRYPTED_NAMES["$file"]}"
gio remove "$GD_URI/$REMOTE_DIR/${REMOTE_ENCRYPTED_NAMES["$file"]}"
cat "$file" | push_file "$REMOTE_DIR/${REMOTE_ENCRYPTED_NAMES["$file"]}"
if ((PIPESTATUS[1] > 0))
then
Expand Down Expand Up @@ -489,7 +489,7 @@ gds_force_push()

if test -f "$file"
then
gio trash "$GD_URI/$REMOTE_DIR/${REMOTE_ENCRYPTED_NAMES["$file"]}"
gio remove "$GD_URI/$REMOTE_DIR/${REMOTE_ENCRYPTED_NAMES["$file"]}"
cat "$file" | push_file "$REMOTE_DIR/${REMOTE_ENCRYPTED_NAMES["$file"]}"
if ((PIPESTATUS[1] > 0))
then
Expand Down Expand Up @@ -548,7 +548,7 @@ gds_rdel()
((i++))

echo "$file"
gio trash "$GD_URI/$REMOTE_DIR/${REMOTE_ENCRYPTED_NAMES["$file"]}"
gio remove "$GD_URI/$REMOTE_DIR/${REMOTE_ENCRYPTED_NAMES["$file"]}"

unset REMOTE_MTIME["$file"]
REMOTE_UPDATED=true
Expand Down

0 comments on commit 341a9d6

Please sign in to comment.