Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Make any folder a burn folder System 10.4
Tiger only hintIf you haven't yet realized just how useful burn folders are in Tiger, this hint should do the trick for you.

Though there's a fair amount of behind-the-scenes stuff that goes on to handle burn folders, all they are to the filesystem are normal folders whose names end in .fpbf. Unfortunately, you can't create (or rename) folders with that extension from the Finder (except, of course, by using the GUI to explicitly create a burn folder). However, there's absolutely nothing preventing you from doing so in Terminal.

Creating a burn folder from Terminal is trivial, but not perhaps so exciting. All you do is type:
mkdir "Your Name Here.fpbf"
Replace Your Name Here with the name you'd like to apply to the new burn folder, hit Return, and you'll have a new burn folder, located in whatever directory you were in when you ran the command.

What is exciting is turning a normal folder into a burn folder, burning a disc, and then turning the folder back into a normal folder. First, turn the normal folder into a burnable folder:
mv "Your Name Here" "Your Name Here.fpbf"
In this case, Your Name Here is the name of the existing folder to convert into a burnable folder. After you burn the folder, use this command to switch it back:
mv "Your Name Here.fpbf" "Your Name Here"
There's no need to mess around with aliases or the like; burn folders are happy to burn real files just as well as aliases. I'm sure this would be a trivial thing for some enterprising soul to put into a script for the Finder's contextual menu for those who don't care for Terminal. I'd love to see a future version of OS X do away with the concept of burn folders altogether and simply make every folder burnable. (Anybody at Apple reading this?). In the interim, though, this is a good workaround.

[robg adds: I tried to make an Automator action to handle the conversion to/from a burnable folder, but ran into a slight snag: Automator won't remove the extension from the folder. The command to add the extension runs fine in Automator (so I have a usable 'Make Burnable' action), but the command to remove the extension does not -- even though it works perfectly in the Terminal. I've sent this glitch in to the Automator team, and I'll post back if I find a successful workaround. (I had Doug Adams try an AppleScript to remove the extension, but it also failed).]

November 1 Update: OS X 10.4.3 breaks the Automator actions discussed in this hint and comments. It seems, but I have yet to prove it completely, that "get specified Finder items" now grabs the contents of a folder, rather than the folder itself.]
    •    
  • Currently 1.60 / 5
  You rated: 2 / 5 (5 votes cast)
 
[25,141 views]  

10.4: Make any folder a burn folder | 28 comments | Create New Account
Click here to return to the '10.4: Make any folder a burn folder' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Make any folder a burn folder
Authored by: rflo on Sep 23, '05 10:44:54AM
This trick is used in backup 1.0 to provide unattended backups to DVD or CD discs on MacOSX-1.4.

---
Ronald Florence

[ Reply to This | # ]

10.4: Make any folder a burn folder
Authored by: ruaric on Sep 26, '05 06:53:54AM

Nice script! ;-)



[ Reply to This | # ]
10.4: Make any folder a burn folder
Authored by: nvdingo on Sep 23, '05 11:21:18AM

Since you didn't explicitly say you tried this, i have to ask.
did you have the automator action run a shell command to remove the extension??
Currently on my panther laptop, will try myself when i get to the office.



[ Reply to This | # ]
10.4: Make any folder a burn folder
Authored by: robg on Sep 23, '05 01:26:11PM
Yes, that's exactly what I did. My entire "unmake" action looks like this:
  1. Get Selected Finder Items
  2. Run Shell Script (/bin/bash, pass as arguments):
    Do shell script "mv for f in "$@"
    do
        mv "$f.fpbf" "$f"
    done
    
Step two fails, every time. It even fails with a dummy extension (.robg), so this isn't specific to burn folders. The same command works fine in the Terminal (and the reverse command to add the extension works in Automator), so clearly, even though Automator is saying this is being run as a shell script, the Finder or something is intefering in the process.

-rob.

[ Reply to This | # ]
10.4: Make any folder a burn folder
Authored by: nvdingo on Sep 23, '05 02:04:35PM
I thought i had a working script, but i don't know automator well enough, or even applescript.
This code works when you hit run from the automator workflow editor, but does
NOT work if you make it a finder plugin nor does it run if you make it an
application.

it only runs when i test it from the workflow editor as stated above.
when i run it as a plug in or application, it gives me:

Can't make POSIX path of item 1 of {«class cfol» "flash.fpbf" of 
«class cfol» "lindsay" of «class cfol» "Users" of «class sdsk»
  of application "Finder"} into type string. (-1700)

that may be some little applescript thing that i am missing, a class casting here
or there, but i don't know.
my automator action is set as follows
- Get Selected Finder Items
- Run applescript (containing the below code)

on run {myfolders, parameters}
	-- this is by far the kludgiest code i have ever written
	set myNewPath to ""
	repeat with myfolder in myfolders
	    -- this line will leave a trailing /
		set myPath to (POSIX path of myfolder) as string
		
		(* i was having the worst time just figuring out how to trim the trailing / off
		the path name, that the resulting mess is what finally worked and stopped giving
		me NSAppleScript errors that had no explanation with them.
		there must be an easier way to do this, and please, somebody tell me
		the easiest way to trim a single arbitrary character off the end of a string
		*)
		set myPath to text items of myPath
		repeat with i from 1 to ((count of text items in myPath) - 1)
			set myNewPath to myNewPath & ((text item i of myPath) as string)
		end repeat
		-- that mess just stripped the trailing / off my folder
		
		-- use a shell command to find the path to the folder we are looking at
		set myDir to do shell script "dirname " & myNewPath
		
		-- use another shell command to find the basename of the file that has .fpbf
		-- basename always returns just the file, not the path to the file
		set myCurrentFolder to do shell script "basename " & myNewPath & " .fpbf"
		
		-- build our shell script to rename the file and do it
		do shell script "mv " & myNewPath & " " & myDir & "/" & myCurrentFolder
	end repeat
	return myfolders
end run



PS- i hate manipulating strings in applescript, and we shouldn't be forced to buy
Acme script widgets to get the job done either. As good as ASW are, really,
it should be easier to mess with strings in AS

please read comments in code.


[ Reply to This | # ]
10.4: Make any folder a burn folder
Authored by: nvdingo on Sep 23, '05 02:20:50PM
OK THIS ONE WORKS!!! you have to coerce the heck out of the folders passed from get selected items
everything is identical, except for these 2 extra lines

set myfolder to myfolder as alias
set myfolder to POSIX path of myfolder
immediately after the
repeat with myfolder in myfolders
so here is the complete WORKING AS A PLUGIN for the finder code for the run
applescript piece of your workflow

on run {myfolders}
	
	set myNewPath to ""
	repeat with myfolder in myfolders
		set myfolder to myfolder as alias
		set myfolder to POSIX path of myfolder
		
		set myPath to (POSIX path of myfolder) as string
		set myPath to text items of myPath
		repeat with i from 1 to ((count of text items in myPath) - 1)
			set myNewPath to myNewPath & ((text item i of myPath) as string)
		end repeat
		
		set myDir to do shell script "dirname " & myNewPath
		set myCurrentFolder to do shell script "basename " & myNewPath & " .fpbf"
		
		do shell script "mv " & myNewPath & " " & myDir & "/" & myCurrentFolder
		
	end repeat
	return myfolders
end run
enjoy?!?!

[ Reply to This | # ]
10.4: Make any folder a burn folder
Authored by: jecwobble on Sep 23, '05 02:24:20PM

Could it be becasue "$f" actually contains the ".fpbf" extension in it? Notice Mark Hunt's comments: he uses awk to strip off the fpbf extension.



[ Reply to This | # ]
Why?
Authored by: Felix_the_Mac on Sep 23, '05 12:31:25PM

Why is this better than just dragging the folder icon to the CD icon in the Finder sidebar?



[ Reply to This | # ]
Why?
Authored by: Makosuke on Sep 23, '05 05:39:14PM

...because when you drag a folder to a CDR icon, it copies all the data to a hidden disk image in preparation for burning. This takes time and space on the disk. Using burn folders, you don't need to copy any data at all--it burns "in place" where it is, so it's faster and takes no additional disk space.

Much more convienent, particularly when burning 4GB of data onto a DVD-R.



[ Reply to This | # ]
Why?
Authored by: ChaChi on Sep 25, '05 07:05:32AM

Um...you're either still using Panther or smoking crack. FYI, Tiger no longer creates temporary Disk Images when burning CDs from the Finder.



[ Reply to This | # ]
10.4: Make any folder a burn folder
Authored by: mark hunte on Sep 23, '05 02:15:01PM
This works in Automator. ( or hot key applescript ) it lets you choose to make burn folder or un burn folder. you can break them down if you want to two separate actions.
display dialog "Make Burn Folder OR un-Burn Folder" buttons {"Burn Folder", "un-Burn Folder", "cancel"} default button 1
if the button returned of the result is "Burn Folder" then
	my _burn_folder()
else if the button returned of the result is "un-Burn Folder" then
	my Un_burn_folder()
	
else
	
end if


on _burn_folder()
	try
		tell application "Finder"
			set sourceFolder to selection as alias
			set sourceFolder to sourceFolder as string
			set sourceFolder to POSIX path of sourceFolder
			set burn_name to do shell script "echo " & quoted form of sourceFolder & " " & " |awk -F" & last word of sourceFolder & " '{print $1}'"
			set burn_name to burn_name & last word of sourceFolder & ".fpbf" as string
			
			do shell script "mv " & quoted form of sourceFolder & " " & quoted form of burn_name
		end tell
	on error
		set error_message1 to "Select a Folder,  before running the script."
		display dialog error_message1 buttons {"OK"} default button 1
	end try
end _burn_folder

on Un_burn_folder()
	try
		tell application "Finder"
			set burn_name to selection as alias
			set burn_name to burn_name as string
			set burn_name to POSIX path of burn_name
			
			set sourceFolder to do shell script "echo " & quoted form of burn_name & " " & " |awk -F.fpbf '{print $1}'"
			
			
			do shell script "mv " & quoted form of burn_name & " " & quoted form of sourceFolder
		end tell
	on error
		set error_message1 to "Select a Folder,  before running the script."
		display dialog error_message1 buttons {"OK"} default button 1
	end try
	
end Un_burn_folder

---
mh

[ Reply to This | # ]

10.4: Make any folder a burn folder
Authored by: mark hunte on Sep 23, '05 02:47:50PM
Actually This is better, if the folder is already a burn folder this will change it back. If not then this will change it into one
tell application "Finder"
	try
		set source_Folder to selection as alias
		set source_Folder to source_Folder as string
		set source_Folder to POSIX path of source_Folder
		
		if the last word of source_Folder is "fpbf" then
			my Un_burn_folder()
		else
			my _burn_folder()
			
		end if
		
	on error
		set error_message1 to "Select a Folder,  before running the script."
		display dialog error_message1 buttons {"OK"} default button 1
	end try
end tell
on _burn_folder()
	
	tell application "Finder"
		set sourceFolder to selection as alias
		set sourceFolder to sourceFolder as string
		set sourceFolder to POSIX path of sourceFolder
		set burn_name to do shell script "echo " & quoted form of sourceFolder & " " & " |awk -F" & last word of sourceFolder & " '{print $1}'"
		set burn_name to burn_name & last word of sourceFolder & ".fpbf" as string
		
		do shell script "mv " & quoted form of sourceFolder & " " & quoted form of burn_name
	end tell
	
end _burn_folder

on Un_burn_folder()
	
	tell application "Finder"
		set burn_name to selection as alias
		set burn_name to burn_name as string
		set burn_name to POSIX path of burn_name
		
		set sourceFolder to do shell script "echo " & quoted form of burn_name & " " & " |awk -F.fpbf '{print $1}'"
		
		
		do shell script "mv " & quoted form of burn_name & " " & quoted form of sourceFolder
	end tell
	
	
end Un_burn_folder

---
mh

[ Reply to This | # ]

10.4: Make any folder a burn folder
Authored by: matamatangi on Sep 23, '05 05:28:18PM
You said: "Anybody at Apple reading this?"

Instead, post something at:

http://www.apple.com/macosx/feedback/



[ Reply to This | # ]

10.4: Make any folder a burn folder
Authored by: koncept on Sep 23, '05 07:56:01PM
I took the Applescript code being offered here and made a few tweaks. The changes I made were:

1) Bypass awk pipe and unecessary shell script commands
2) allow batch conversions of folders (items not folders will be ignored)
3) streamlined handler so that it will reverse burn folders if set already, and create them otherwise.

Please test this on non-important directories before assuming
that it is problem free (you already knew that though right?) ;)

tell application "Finder"
  set userSelection to selection
  repeat with thisItem in userSelection
    if class of thisItem is not folder then set userSelection to rest of userSelection
  end repeat
  if userSelection is not {} then my toggleState(userSelection)
end tell

on toggleState(aList)
  tell application "Finder"
    repeat with aFld in aList
      if name extension of aFld is not "fpbf" then -- normal folder
        set src to items 1 thru -2 of (text items of (POSIX path of (aFld as string))) as string
        set newSrc to src & ".fpbf"
      else if name extension of aFld is "fpbf" then -- revert
        set src to items 1 thru -2 of (text items of (POSIX path of (aFld as string))) as string
        set newSrc to items 1 thru -6 of src as string
      end if
      try
        do shell script "/bin/mv" & space & quoted form of (src) & space & quoted form of (newSrc)
      end try
    end repeat
  end tell
end toggleState


[ Reply to This | # ]
10.4: Make any folder a burn folder
Authored by: rjbailey on Sep 23, '05 08:11:43PM
This is a great hint! I've found that OnMyCommand makes this very easy to implement. You can easily write command scripts that add and subtract the .fpbf extension to the selected folder, and access the scripts just like you would Automator plugins.

[ Reply to This | # ]
10.4: Make any folder a burn folder
Authored by: rjbailey on Sep 24, '05 02:37:23PM
As this thread degenerates into the a lesson in shell scripting, I'll reiterate: I vastly prefer OnMyCommand for applications like this. There's no need to mess with integrating Automator and AppleScript, just this:
mv __OBJ_PATH__ __OBJ_PATH__.fpbf

and it's in a contextual menu. The reverse is just as simple:
mv __OBJ_PATH__ __OBJ_PATH_NO_EXTENSION__

And OMC offers context filtering so you'll only get folder-specific options when you right-click on folders--no need to do that logic in your applescript or shell script. There's a million other examples on the website.

[ Reply to This | # ]
10.4: Make any folder a burn folder
Authored by: Rogue.Monk on Sep 23, '05 09:37:33PM
Here's my try using the "Run Shell Script" command.

It will change the folder from regular to burn and back again.

for i
do
	#get basename and remove ".fpbf" if it exists
	baseFolder=$(basename -s .fpbf "$i")
	#get natural basename
	burnFolder=$(basename "$i")
	#get folder path for later use
	folderPath=$(dirname "$i")

	#if item is a burn folder, make it a regular folder
	if [ -d "$i" ] && [ "${baseFolder}.fpbf" = "$burnFolder" ]
	then
		mv "$i" "${folderPath}/${baseFolder}"
	#if item is a regular folder, make it a burn folder
	elif [ -d "$i" ] && ! [ "${baseFolder}.fpbf" = "$burnFolder" ]
	then
		mv "$i" "${folderPath}/${baseFolder}.fpbf"
	fi
done
Even though this works for me, I haven't been shell scripting that long and this can probably be refined further.

-Dave


[ Reply to This | # ]
Faster, More Compact
Authored by: nicksay on Sep 24, '05 01:13:11AM
Here's another version of the shell script. It executes completely within the bash shell, so it's faster than scripts that call other utilities. For those who like such things, it's highly compact as well. Finally it works on the command line as well as in Automator.

#/bin/bash
for i in "$@"; do if [ -d "$i" ]; then
  i="${i%/}"; f="${i##*/}"; p="${i%/*}"
  [[ "$f" = "$p" ]] && p="."
  [[ $f == *.fpbf ]] && n="${f%.fpbf}" || n="$f.fpbf"
  mv -v "$i" "$p/$n"
fi; done
Note that your shell should be "/bin/bash" in Automator.

[ Reply to This | # ]
Faster, More Compact
Authored by: bluehz on Sep 24, '05 04:01:24AM

The bash script works great as Automator action. Thx!



[ Reply to This | # ]
Faster, More Compact
Authored by: dashard on Sep 24, '05 10:07:01PM
The compact bash script posted above works phenomenally well, and wicked fast too. I saved mine as a Finder plug-in for Automator, so all I have to do is right-click the deired folder to toglle the setting. I names the script/plug-in "Burn Folder Toggle".

One note of advice: if you intend to use this script in this way, make sure that you set up Automator to "pass input as arguments" or the whole thing will fail (gracefully).

Bravo and well done!

[ Reply to This | # ]
Me Talk Pretty One Day
Authored by: dashard on Sep 24, '05 10:09:30PM

An d me t hin k that me shoud reed ovr my writng be4ore posting nex tim e.

(My apologies for the previous typo-fest!) :-)



[ Reply to This | # ]
Faster, More Compact v2
Authored by: nicksay on Nov 06, '05 09:39:52PM
If you have the Developer Tools installed, then you can run an improved version of this script. You can use the SetFile tool to hide the burn folder extension in the Finder. Use the following code in place of the above:
#!/bin/bash
for i in "$@"; do if [ -d "$i" ]; then
	i="${i%/}"; f="${i##*/}"; p="${i%/*}"; e="e"
	[[ "$f" = "$p" ]] && p="."
	[[ $f == *.fpbf ]] && n="${f%.fpbf}" || { n="$f.fpbf"; e="E"; }
	sf="/Developer/Tools/SetFile"
	[ -x "$sf" ] && $sf -a $e "$i"
	mv -v "$i" "$p/$n"
fi; done
If you're making this an automator action, make sure your shell is /bin/bash and be sure pass the input as arguments.

[ Reply to This | # ]
10.4: Make any folder a burn folder
Authored by: virius on Sep 24, '05 05:06:51AM
I like the feature of burnable folders, and was happy to find it so easy to make an existing Folder burnable.
I am still not adopted to Automator, so I wrote a Droplet to toggle the "burnable state" of a folder.

You can download it from here.
Hope you like it! Feedback welcomeÖ

[ Reply to This | # ]
10.4: Make any folder a burn folder
Authored by: Mitchell on Sep 24, '05 06:46:51PM
I was unable to make this work using neither OnMyCommand, nor Automator, nor AppleScript. The command line, of course, worked perfectly. Doing a little digging, it appears that if you make your main drive invisible, using this hint, then you'll have a problem with the user interface, which manifests in AppleScript as a "Could Not Get Class of Folder..." error. Switching the state of the root volume back to visible seems to fix the problem. If anyone has a suggestion for how to do it while maintaining the invisibility of the root volume, I'd be very interested.

[ Reply to This | # ]
10.4: Make any folder a burn folder
Authored by: rjbailey on Sep 25, '05 05:46:37PM

Here's the code that works in OMC:
<dict>
<key>ACTIVATION_MODE</key>
<string>act_folder</string>
<key>CATEGORIES</key>
<array>
<string>File</string>
</array>
<key>COMMAND</key>
<array>
<string>mv </string>
<string>__OBJ_PATH__</string>
<string> </string>
<string>__OBJ_PATH__</string>
<string>.fpbf</string>
</array>
<key>EXECUTION_MODE</key>
<string>exe_silent</string>
<key>NAME</key>
<string>Change folder to Burn Folder</string>
<key>NOTES</key>
<string>Simply appends .fpbf to folder name</string>
<key>SUBMENU_NAME</key>
<string>On My Command</string>
<key>VERSION</key>
<integer>1</integer>
</dict>

And the reverse that removes the extension:

<dict>
<key>ACTIVATION_MODE</key>
<string>act_folder</string>
<key>CATEGORIES</key>
<array>
<string>File</string>
</array>
<key>COMMAND</key>
<array>
<string>mv </string>
<string>__OBJ_PATH__</string>
<string> </string>
<string>__OBJ_PATH_NO_EXTENSION__</string>
</array>
<key>EXECUTION_MODE</key>
<string>exe_silent</string>
<key>NAME</key>
<string>Delete folder extension</string>
<key>NOTES</key>
<string>Removes folder extension</string>
<key>SUBMENU_NAME</key>
<string>On My Command</string>
<key>VERSION</key>
<integer>1</integer>
</dict>



[ Reply to This | # ]
10.4: Make any folder a burn folder
Authored by: jacobolus on Sep 25, '05 04:01:52AM
I ran into the same problem trying to make an action that would run "mdls" and display the results in a text file. Somehow "get selected finder items" doesn't send the right thing to shell scripts. So an intermediate step, if you add an applescript which does:
on run {input, parameters}
	set myList to {}
	repeat with myItem in input
		set myItemPath to POSIX path of myItem as text
		set myList to myList & {myItemPath}
	end repeat
	return myList
end run
That should straighten everything out. Hope that helps.

[ Reply to This | # ]
10.4: Make any folder a burn folder
Authored by: Mr Tea on Sep 26, '05 07:31:45AM

Here's a simple script to remove the ".fpbf" extension:

tell application "System Events"
  choose folder returning theFolder
  set fName to name of theFolder
  set tids to AppleScript's text item delimiters
  set AppleScript's text item delimiters to ".fpbf"
  set newname to text item 1 of fName
  set name of theFolder to newname
  set AppleScript's text item delimiters to tids
end tell

---
"Always remember to warm the pot."



[ Reply to This | # ]
10.4: Make any folder a burn folder
Authored by: zoff on Feb 24, '07 11:55:49AM

This script works fine on my startup drive, but on an exteral drive when I chose to make a folder an "unburn folder" it deleted the folder!



[ Reply to This | # ]