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

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


[ Reply to This | # ]