Removing .SyncTrash & contents on OSX


Recommended Posts

I understand that this has been addressed in the FAQ. At this time, one needs to manually empty the .SyncTrash folders. Although a user had posted a Batch script for Windows, I was wondering if someone on OSX has attempted something similar?

I am using "launchd" on Mountain Lion 10.8.4 to recursively delete the .SyncTrash folder and all its contents on an daily basis. Is there a more elegant way of doing this?


find /Volumes/XX/PathToMainFolder -name .SyncTrash -exec rm -rf '{}' ';'

On a different note, is it not possible to bring up the WebUI for Bittorrent Sync on OSX?

Link to comment
Share on other sites

I'd use a simple bash script to manage all kind of trashes.

Here's mine:


#!/bin/bash
trashes="/mnt/Volume/.Trash*/
/mnt/Volume/.Dropbox/.dropbox.cache/*
/mnt/Volume/*/.SyncTrash/"

case "$1" in
rm)
for dir in $trashes; do
if [ -d "$dir" ]; then
rm -rf "$dir"
fi
done
;;
gc)
for dir in $trashes; do
if [ -d "$dir" ]; then
find "$dir" -depth -type f -ctime +7 -exec rm -rf "{}" \;
find "$dir" -depth -type d -empty -exec rmdir "{}" \;
fi
done
;;
ls)
for dir in $trashes; do
if [ -d "$dir" ]; then
find "$dir" -type f -printf "[%Cm.%Cd %CH:%CM] %p\n"
fi
done
;;
*)
echo "Usage: $0 {rm|gc|ls}"
exit 1
esac
exit 0

You can set up "/path/to/script gc" as a daily cronjob and it deletes files that have been trashed 7 days ago.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.