Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

killmoms

macrumors 68040
Original poster
Jun 23, 2003
3,752
55
Durham, NC
Okay, question about a slightly odd situation I'm in. I have an archive of a website I was very fond of back in the day on 14 CDs. Of course, each CD only has certain parts of the website on it, but many of the same folders (just more files in those folders). How can I copy all these CDs' files into the same directory tree, since Finder seems to only replace a folder with the new version? Unix commands acceptable, if necessary.
 

scan300

macrumors 6502
Mar 25, 2003
256
0
Melbourne, Australia
Generally you could use a backup utility to do this. But I thought I would try this as an applescript exercise.

The following script, when run, will ask for a source folder: the folder which contains your original html files. (disk one. (you can select the disk icon if that's the root of your site tree).

Then it will ask for a destination folder. This is where you will build your conglomerated site.

After it has finished copying, select your next disk and repeat the process. The script will basically keep adding to your destination file structure, and add folders where needed, but it won't replace any existing files or folders in the destination folder.

Please note this script has no progress indicator, it will tell you when it's finished, that's all. Basically select the source and destination the same way you would choose a location to copy a folder to normally in the finder. This script will just make sure it doesn't overwrite anything already there.

Copy the following code into your applescript editor and save as application which you can double click to run, or just compile and run it straight from the script editor. Leave me a post if it works.

Code:
property myFolderName : ""
property text3 : ""

choose folder with prompt "select a source"
set mySourceFolder to result
global mySourceFolder
set myWorkingFolder to mySourceFolder
choose folder with prompt "select a destination"
set myDestinationFolder to result
global myDestinationFolder
my ListFolder(mySourceFolder)
display dialog "Finished"

on ListFolder(myWorkingFolder)
	
	tell application "Finder"
		set myFolderName to name of myWorkingFolder
		set myFolderContents to every file of myWorkingFolder
		set myFolderList to every folder of myWorkingFolder
		
		if (myWorkingFolder is not mySourceFolder) then
			set text1 to length of (mySourceFolder as string)
			set text2 to length of (myWorkingFolder as string)
			set text2a to myWorkingFolder as string
			set text3 to characters (text1 + 1) thru text2 of text2a as string
			
			set newFPath to ((myDestinationFolder as string) & text3)
			
			set ftext1 to length of (newFPath as string)
			set ftext2 to (length of myFolderName) + 1
			set ftext2a to newFPath as string
			set ftext3 to characters 1 thru (ftext1 - ftext2) of ftext2a as string
			
			try
				make new folder in folder ftext3 with properties {name:myFolderName}
			end try
			
		end if
		
		repeat with x in myFolderContents
			set newPath to ((myDestinationFolder as string) & text3)
			try
				duplicate x to folder newPath without replacing
			end try
		end repeat
		
		repeat with y in myFolderList
			ListFolder(y) of me
		end repeat
		
	end tell
	
end ListFolder
 

dubbz

macrumors 68020
Sep 3, 2003
2,284
0
Alta, Norway
Heh, that used to be a big source of confusion and annoyance to me. I ended up using Rsync X (It's a OS X GUI for the UNIX rsync utility). It's perhaps a bit of overkill, but it works :)
 

killmoms

macrumors 68040
Original poster
Jun 23, 2003
3,752
55
Durham, NC
Thanks for the assistance, but I asked a Linux using friend of mine, and he suggested cp -R source destination. Worked like a charm. KISS I guess. Just thought you guys would like to know.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.