![]() |
To Applescript, Shell command or Automater?
Hi,
I'm looking for some advice and (possible) help to implement some type of automated workflow of a set of directories. Essentially, I need some way of taking a directory of any size and running it through a workflow that automatically creates multiple directories based on a maximum size (i.e. 4gb for DVD media) that are incrementally named. For example I have a folder called "Work" that contains 40gb worth of other directories. The workflow then creates 10 Directories named "Archive 1, Archive 2 and so on..." and moves the files around so each Archive directory holds around 4gb *Can you guess what I'm trying to do ;) I would appreciate any help or advice if this would be better being an Applescript, Shell Command, or an Automater workflow. Also being really cheeky if anyone can give me a starter for 10 that would be magic. Thanks in advance for any help. |
Have you heard of Time Machine? It will be part of Leopard. Maybe you should wait a few weeks and use that. ;)
|
Ah, yes that would be lovely - unfortunately it all has to go back to PC based server, so I'll need an independent workflow rather than something built into the OS. But thanks for the reply.
|
this is fairly easy to do in applescript, though I'm guessing (perhaps erroneously) that there are other constraints (such as you'd prefer to keep files with similar dates together, or files with similar names, or you'd like to waste as little space as possible on the DVDs). these other constraints can complicate things immensely. but the basic script looks like this:
Code:
tell application "Finder"I don't suppose it would be too hard to turn it into an automator workflow, if that's what you wanted... |
zip and tar both claim to support "spanning" to break an archive into multiple members. That might be simpler for you, and save on disks as well.
|
well, for that matter, I seem to remember that Toast will automatically split things into multiple disks (if you're burning as HFS+). the only issue I would have with a segmented zip or hqx, though, is that you're in trouble if one of the disks gets scratched or lost.
|
wow, thank you to everyone for all their help! Very much appreciated.
TW, sorry to be a pain, I'm more used to a CLI - how does one specify the "path to directory" in Applesript? I've tried /Users/Username/Desktop to no avail. (And of course, a huge thank you for writing the script!) |
well, in applescript you use the colon notation rather than the slash notation. so, to reference a folder on the desktop, the path would be:
Code:
HD:Users:Username:Desktop:Folder NameCode:
-- use this only outside of a Finder tell blockCode:
-- outside a Finder tell |
I am trying to use this rather nice "splitter-upper" script on a very large folder stored on a mounted volume that is not the root volume. It fails because it says the fileSize is missing value. I remember something about the Finder being reluctant to compute size on other volumes, but not how to cure that.
|
Quote:
Code:
get physical size of every item of folder "--random--"you could also hack the file size up out of unix, at need: Code:
set fileSize to physical size of (item j of theItems) |
Quote:
|
Sorry to be a pain, just got back to this tonight and tried to run the script as a test. An alert box pops up saying "AppleScript Error: Can't make missing value into type number."
With the value "cumulativeSize" highlighted on the line: "else if fileSize + cumulativeSize is less than sizeCap then" Sorry to be such a newbie. |
sorry, my bad - seems some of the folders had bad permissions/errors. All fixed now and working a bloody treat! Thank You!
|
Quote:
Code:
set splitThisFolder to folder "path to folder to be copied" |
| All times are GMT -5. The time now is 05:32 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.