need help with a dvd burning script...

i need a script that will prompt a user to select a set of data from a server, copy it to a local folder, split the selcted files into ~4.5gb sets, and then burn each of those sets to DVD. once complete it needs to trash the local data.

i’m fine with the user having to swap out media, but i’d greatly prefer a method that would allow me to employee 4 drives, either simultaneously burning or one after another. the goal is to allow the user to backup nearly 20 GB of data with as little supervision / involvement as possible.

to help clarify - the files that are being b/u’d are each 8 or 16 mb. (digital camera files) so ‘splitting’ a single file across two discs isn’t needed, and something that i’d specifically like to avoid.

thanks so much for the help.

Model: various G5 towers and G4 PB’s
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Be a little more specific about ‘set of data’. What is the user ‘selecting’ – Files, Folders full of files?

It will be one after the other. Burning multiple disks doesn’t accomplish anything in total time because the system still does them one at a time.

This will be slow and unreliable because you’ll be hindered by the network. Duplicate the files from the server to the machine that will do the burning, then use the Finder to get the size of info for each file to be added to a burn folder, accumulating the size as you go. At some limit, you stop and burn, paying attention to where you left off in the file list.

You should use ‘search’ to look for other examples - there are some.

i have searched a fair amount, but not with much luck. i’m the first to admit that my most basic knowledge of scripting has probably hindered my ability to fully understand the search results.

  1. the user will be selecting a group of files, roughly 500-1500. i want the script to then divide the files into the 4.5 gb sets, so that each set will fit on the DVD

  2. ok, i understand that the total time required for the burn isn’t influenced by the number of drives. however, is it possible to utilize multiple drives so that the user could load 4 blanks into 4 drives, walk away, and come back X min / hours later to a complete back up?

  3. copying the data from the server to a local folder is the first task i want the script to accomplish. this normally takes about 15 min. i don’t understand the point of your comment here. can you clarify?

What is your basic knowledge of scripting? If this is your first try, you have a long way to go.

How are they selected? As loose files, as a group of folders, as one big folder containing all? Does the file structure have to be preserved? Does the user do the selection? Of what? individual files? If you’re going to automate, you have to know exactly what you’re dealing with in the script. Is the starting point a selection from a Finder window mounted on the burner’s desktop?

The trouble is that you can’t just load 4 blank disks and expect them to mount - they’ll be ejected after the system examines them, so the burning software has to recognize them. Here’s a key question: Using the burning software you have in mind, can you now set up four burn folders by hand, load disks one at a time and associate each to one of the burn folders, start up your process, and then go away? If not, why not. Have you tried this? I ask because very few folks on this forum will have even two CD burning drives installed, so they won’t be able to test what they propose. If you intend to use standard System’s Disk Utility, then I doubt if you can do it (but can’t try myself - I only have one drive).

I just meant that you cannot burn a disk from files stored remotely with any reliability. Is the server running OS X? If so, a shell script is probably faster at duplicating a large number of files to the ‘burner’ than the Finder is. Are you familiar with the shell? Have you used the Terminal?

I wrote this script a while back, and just updated it slightly.

Its set to to split the chosen files. ( not folders ) in to size-able chunks to burn on 700mb cd’s and make burn folders in the documents folder of the files

At the end it will open the burn folders and also a text file showing any individual files that exceed the 700mb target on their own.

you will need to do the math for your dvd. I think it should be set to “4724464026” byte which should be 4.4 GB
“4831838208” 4.5 GB
Set to just under the disk limit. Put it in the property theMblimit

I’m sure the script can be cleaned up and optimised, but it is actually very quick.

(* Created by mark hunte   2005. -re-edited 2006 *)
property biglist : {}
property thebyte : 1024
property theSecond_pass : false
property source_folder : path to documents folder from user domain
property theMblimit : "723517440" as number
set thecount to 0
set counter to 0
set burnfoldersLsit to {}

do shell script " echo > ~/documents/Not_added_too_big.txt"
global the_file, thecount, counter, burnfoldersLsit

tell application "Finder"
	set the_file to choose file with multiple selections allowed without invisibles -- selected folders will not be included
	repeat with i from 1 to number of items in the_file
		tell application "Finder"
			set this_item to item i of the_file
			--if label index of this_item is 0 then
			copy this_item to end of biglist
			--end if
		end tell
	end repeat
	--say (count of biglist)
end tell
my m_make(biglist)
--say "no more"
set biglist to {}
tell application "Finder" to open items of burnfoldersLsit

on m_make(biglist)
	set thecount to 0
	tell application "Finder"
		--set counter to 0
		set biglisit_end to (count of biglist) as string
		--say biglisit_end
		--say counter
		set not_add to file "Not_added_too_big.txt" of source_folder
		set counter to 0
		set dated to hours & minutes & seconds of (current date) as string
		set the foldername to "Burn_disk_" & dated & ".fpbf"
		if not (exists folder foldername of source_folder) then
			set the_burn_folders to make new folder at source_folder with properties {name:foldername}
			copy the_burn_folders to end of burnfoldersLsit
			repeat with c from 1 to number of items in biglist
				get c
				if c is greater than (count of biglist) then
					exit repeat
					if size of (info for item c of biglist) is less than theMblimit then
						set thecount to thecount + (size of (info for item c of biglist)) -- as integer)
						set thecountofmb to thecount / thebyte
						if thecount is less than theMblimit then
							set a_item to item c of biglist
							--if label index of a_item is 0 then
							make new alias file at folder foldername of folder source_folder to a_item
							--set label index of a_item to 2
							set counter to counter + 1
							--end if
						else if thecount is greater than theMblimit then
							--say (count of biglist)
							set biglist to items (count of items of biglist) thru counter of biglist
							--say (count of biglist)
							set counter to (count of items of biglist) as string
							my m_make(biglist)
						end if
						set counter to counter + 1
						set p_item to quoted form of POSIX path of item c of biglist
						do shell script " echo " & quoted form of p_item & return & "--------------------------------" & return & " >> ~/documents/Not_added_too_big.txt"
						copy not_add to end of burnfoldersLsit
					end if
				end if
			end repeat
		end if
	end tell
end m_make