By Matthew Bronleewe @Matthew_Bronleewe
I'm very new to SoundFlow / Stream Deck! What script would I use to compress (zip) a folder, then move (or copy) that zipped file to a pre-existing Dropbox folder? (Note: The Dropbox folder exists within the folder structure on my computer, not an online location.)
- Chris Shaw @Chris_Shaw2024-01-26 20:21:52.049Z2024-01-27 04:35:38.368Z
Hey Mathew,
If you're always using the same destination folder you can use this script. Read the comments to set your destination folder. These scripts will create the zip file in your destination folder (no need to move it)./* You can get a directory's path by opt-right-clicking on a folder and selecting " Copy "[FOLDER NAME]" as Pathname" Paste this into <COPIED PATHNAME> Be sure to leave the quote marks Line 15 should look something like: const dropBoxFolderPath = "/Volumes/Work Drive/Dropbox" */ // Select folder in finder before running! const dropBoxFolderPath = "<COPIED PATHNAME>" const selectedFolderPath = sf.ui.finder.selectedPaths[0]; if (!selectedFolderPath) { log("ZIP Folder Scipt", "NO FOLDER SELECTED") throw 0 } const folderPathArray = selectedFolderPath.split("/"); const folderName = folderPathArray[folderPathArray.length - 2] sf.file.zipDirectory({ sourcePath: selectedFolderPath, archivePath: `${dropBoxFolderPath}/${folderName}.zip` })
If you want to select the destination folder each time use this:
// SELECT FOLDER IN FINDER BEFORE RUNNING!! const selectedFolderPath = sf.ui.finder.selectedPaths[0]; if (!selectedFolderPath) { log("ZIP Folder Scipt", "NO FOLDER SELECTED") throw 0 } const dropBoxFolderPath = sf.interaction.selectFolder({ prompt: "Pick your destination folder", }).path const folderPathArray = selectedFolderPath.split("/"); const folderName = folderPathArray[folderPathArray.length - 2] sf.file.zipDirectory({ sourcePath: selectedFolderPath, archivePath: `${dropBoxFolderPath}/${folderName}.zip` })
- MIn reply toMatthew_Bronleewe⬆:Matthew Bronleewe @Matthew_Bronleewe
This works great! I was able to input the destination folder and it's running smoothly!