Python program that automatically renames, moves and eventually converts any kind of files from the "DropsyncFiles" folder to the "Camera Uploads" folder.
dropsync_shift_rename.py
is a Python program that allows you to automatically,
rename, centralize and eventually convert (e.g. from ".m4a" to ".mp3", from ".webp"
to ".png", etc.) all files synchronized in the "DropsyncFiles" folder to the
"Camera Uploads" folder.
Dropbox is certainly the most reliable file hosting service out there. This
application allows you to easily synchronize files such as pictures and text
files between different devices (computers, tablets, phones, etc.). Many users
utilize Dropbox to automatically upload their photos from their phone to their
computer. Although this solution is just ideal for iPhones, it is much less
useful for Android phones. In fact, for these devices, photos received from
WhatsApp conversations (for example) are not uploaded to the cloud. Indeed, only
the documents located in the DCIM
directory (/storage/emulated/0/DCIM
) of
the phone (i.e. photos and videos taken with the Android device, screenshots,
video captures, etc.) are synchronized with the Dropbox account. Unlike iPhones,
Android phones must therefore make use of a third-party application to
synchronize files from WhatsApp, Telegram, Snapchat, etc. An effective solution
is the Dropsync Ultimate Android app. This application allows to sync multiple
pairs of folders between the Android phone and the Dropbox account. As depicted
in the settings image below, I decided in my case to sync all documents from
(for instance) the WhatsApp, Telegram and Snapchat folders on my Android phone.
Here is the list of Android apps for which the storage folder is currently one-way synced from the SD card of my phone to my Dropbox account via Dropsync Ultimate:
Android app name | Android storage folder | Corresponding created Dropbox storage folder |
---|---|---|
/storage/emulated/0/Android/media/com.whatsapp/WhatsApp/Media | Dropbox/DropsyncFiles/Media_UnidirectionalSync_AndroidToMac/WhatsApp | |
Telegram | /storage/emulated/0/Telegram | Dropbox/DropsyncFiles/Media_UnidirectionalSync_AndroidToMac/Telegram |
Snapchat | /storage/emulated/0/Snapchat | Dropbox/DropsyncFiles/Media_UnidirectionalSync_AndroidToMac/Snapchat |
Download Music Mp3 | /storage/emulated/0/Download/MusicDownload | Dropbox/DropsyncFiles/Media_UnidirectionalSync_AndroidToMac/MusicDownload |
TubeMate 3 | /storage/emulated/0/VidMate | Dropbox/DropsyncFiles/Media_UnidirectionalSync_AndroidToMac/VidMate |
Instander | /storage/emulated/0/Pictures/Instander | Dropbox/DropsyncFiles/Media_UnidirectionalSync_AndroidToMac/Instander |
Note: TubeMate 3 (the successor to VidMate) can be used to download YouTube videos in both ".mp4" and ".mp3" formats. This is the reason why Download Music Mp3 tends to be less used because this app only allows to download YouTube videos in ".mp3" format.
The Python program dropsync_shift_rename.py
allows to rename the synchronized
files in the the DropsyncFiles
directory on the computer (among others by
adding their creation date) and to centralize them in the Camera Uploads
folder, where they are supposed to arrive in the case of an iPhone. It also
takes care of removing unwanted files that I don't want to store, such as photos
and videos that I would have sent myself to friends via WhatsApp.
Note: the
Dropsync Shift and Rename
Alfred workflow implements thedropsync_shift_rename.py
Python program. After installing the Alfred macOS app and theDropsync Shift and Rename
workflow, simply type theds
hotkey in the Alfred search bar. Thedropsync_shift_rename.py
Python program is then automatically triggered and runs in iTerm2.
- Tested on macOS Big Sur version 11.4
- Python 3.8
pip install -r requirements.txt
-
To access useful help messages, type following Terminal command at the root of the project:
/usr/local/bin/python3.8 src/dropsync_shift_rename.py -h
-
To use the program, adapt the path constants
DROPSYNCFILES_DIRECTORY_PATH
andCAMERA_UPLOADS_DIRECTORY_PATH
defined at the beginning of the code. Then, to run the program, type following Terminal command at the root of the project:/usr/local/bin/python3.8 src/dropsync_shift_rename.py
Notes:
- With a Bash Terminal window,
/usr/local/bin/python3.8
can simply be replaced bypython3.8
.- In case the
Dropbox/DropsyncFiles/Media_UnidirectionalSync_AndroidToMac/
folder weights more than 1[MB] after transfer (i.e., after running the program), iTerm2 is not exited in order to let the user observe the log messages in the Terminal to determine where the error comes from and what caused this issue. In fact, in case of normal operation of the program, this folder should be completely empty after running the program (all files should be transferred to the DropboxCamera Upload
folder. If thisDropbox/DropsyncFiles/Media_UnidirectionalSync_AndroidToMac/
folder is not empty, it means that an error occurred somewhere during the program execution.
- 0.1
- Initial release