100 Copies Loop

We’re doing year two of the Social Work Portfolio in Google Docs. I am opting to do the creation/duplication of the main files on the computer end rather than the Google Drive/Scripts side of things because of all the hassle from last year. You can read more about the full failure here.

This AppleScript will give me 100 iteratively-named (x_1, x_2, etc.) copies of the source folder and all its sub-directories and their content. It is just adding a variable from the AppleScript to the loop that calls the terminal command ditto.

tell application "Terminal"
	repeat with theIncrementValue from 100 to 1 by -1
		set folderNum to {theIncrementValue as string}
		set currentTab to do script ("ditto /Users/yournamehere/Desktop/BSW_Graduation_Portfolio_2018 /Users/yournamehere/Desktop/sw18/BSW_Graduation_Portfolio_2018_" & folderNum)
	end repeat
end tell

I’m sure a shell script could do this or I could do it fully in Automator. There are many paths but I knew enough about both of these to get what I needed one in ~5 minutes.

Next up will be automating the sharing via Google Script. It won’t be much different than last year but I’m going to add a piece that will write that the folder and the contents were successfully shared to the spreadsheet that holds the student emails. That way when/if the script fails it can auto-resume without having to go back and start over.

Comments on this post

No comments.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Trackbacks and Pingbacks on this post

No trackbacks.

TrackBack URL