Working remotely from home brought many challenges, one of them was the downloading/uploading of files through the VPN.
Often we’ll need to donwload a single file in a project rather then the whole project folder, this created a tedious task of creating subfolders to be able to copy the file while maintaining the same folder structure from the server we are pulling from, same goes when we need to upload new files or folders.
The Copy Local / Server actions handles all the tedious task involved in copying and maintaining a mirror folder structure from the server, and it is conveniently accessible from Windows Explorer as you navigate folders.
A settings file is provided to define the local and server paths. Although these actions were intended to copy files through the VPN, you can actually assigned any folder to these paths, these include within your own computer, between your drives, or between folders in the server. It essentially replaces the paths and does the copying.
Copy Actions
Copy to Local - Checks the selected file is within the server path, it copies the file if the file does not exists locally, if it does exists it will create a text file with the name of the file with a suffix “_exists” in the same folder of the original file. To override the file use Copy/Overwrite to Local instead.
Copy/Overwrite to Local - Checks the selected file is within the server path and copies/overwrites the file locally.
Copy to Server - Checks the selected file is within the local path, it copies the file if the file does not exists in the server, if it does exists it will create a text file with the name of the file with a suffix “_exists” in the same folder of the original file. To override the file use Copy/Overwrite to Server instead.
Copy/Overwrite to Server - Checks the selected file is within the local path and copies/overwrites the file to the server.
Technical Overview
The Actions run on Python 3 in the background, it uses local and server paths (defined in the settings.txt) to verify and perform the copy actions. It uses the python shutil module to copy files and windows xcopy to copy folders.
When installing, these actions are registered in Windows Registry Editor. Each action is assigned a specific number id for the python script to perform the corresponding Copy Action.
Since these actions run externally from Windows Explorer by using python scripts in the background, the actions communicate important messages to the user by creating text files in the directory where the intended file resides. These messages inform the user if the file exists in the folder we are trying to copy, status of a file being copy, or if the directory of the file does not correspond to the local/server settings.