|
|||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
#1 |
|
Triple-A Player
Join Date: Jun 2004
Posts: 198
|
Ok this is an incredibly stupid question, but here goes:
if I have a directory with files in it called IMAGES, and I copy a blank folder called IMAGES to that directory, all of the files in the IMAGES folder are NUKED. How do tell OSX to copy a folder and tell it to replace files IN that folder, not nuke everything in the folder? I want it to replace all of the files in the folder not nuke anything. |
|
|
|
|
|
#2 |
|
Triple-A Player
Join Date: Jun 2004
Posts: 198
|
http://www.xvsxp.com/files/copying.php
Ok, now I understand the stupid way OSX copies folders. The question is, how do I copy a folder the way Windows will do it? |
|
|
|
|
|
#3 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,627
|
I guess you are asking about a file copy and merge, which OS X avoids doing. If you replace a folder with another folder of the same name, OS X basically doesn't care what's inside the folder.
Here's some good info and links in this thread - http://forums.macosxhints.com/showthread.php?t=66791 |
|
|
|
|
|
#4 |
|
MVP
Join Date: Jan 2007
Posts: 1,419
|
"How do I copy a folder the way Windows will do it?"
You may want to explore Apple's FileMerge app. It's part of the Developer utilities. It will let you accomplish what Windows does (and more), but it won't make your Mac copy in the same way that a Windows machine does. Sections from FileMerge's help files are below. Comparing Files Viewing a File Comparison Merging Files Comparing Directories Viewing a Directory Comparison Merging Directories Setting Preferences Filtering Files Using FileMerge From the Command Line |
|
|
|
|
|
#5 |
|
Registered User
Join Date: Aug 2008
Posts: 1
|
How to merge folders in OS X, just like Windows - NO command line!
I too have missed this function in Windows; indeed, it's the only thing I've missed under Windows, ever. But I found a tiny GUI AppleScript called Merge Folders 1.0.1; it's freeware, and seems to do exactly what you're asking for.
It uses the UNIX cp command, so it ends up acting just like Windows in the sense that it just merges multiple folders together, maintaining the structural integrity of all sub-folders, and not overwriting files with the same name. The GUI presents you with a browse dialog asking for the source folder(s). You don't have to browse, though; you can just drag the source folder(s) into the browse dialog. Then it asks for a destination; again, just drag the destination folder into the browse dialog. It then asks what to do about existing files: Overwrite, Cancel, or Skip? Hit "Skip"; you now have a merged folder in the destination. All sub-folders and directory structures seem to be maintained perfectly. Here's the link; just click the link to "Merge Folders 1.0.1" to download once you get to the page: http://scriptbuilders.net/files/mergefolders1.0.1.html Since it's freeware I'm assuming the author won't mind my posting the script here; his name is Bruce Philips and his website is http://brucep.net/ It can be made to be reasonably well-integrated with OS X using Automator. Copy the script below into a *completely blank* "Run AppleScript" action under Automator, then save it as a Finder Plug-in named "Merge Folders". It gets added to your contextual menu under "Automator" and you can just call it right up by Ctrl-clicking or right-clicking. Folder merging at your fingertips. To do this, go to your Applications folder, open Automator, and type "applescript" into Automator's search bar. Then under the "actions" listing on the left, you should see "Run AppleScript". Drag it to the blank gray field on the right. Now select and completely delete *all* text from the Automator's "Run AppleScript" action. Then paste the script below into the "Run Applescript" action's blank field. Now, under the File menu, choose "Save As Finder Plug-in", and make sure the resulting dialogue's drop-down menu is set to "Plug-in For: Finder". Save it as "Merge Folders", and close Automator. Now when you're in the Finder, Ctrl-click or right-click anywhere, and in the resulting contextual menu, go down to Automator; the sub-menu should contain an item called "Merge Folders". Click on "Merge Folders" and the script runs. Select a source and destination, and the folders are merged-- sub folders intact, and with no overwriting-- into the destination folder. Remember, you can drag each folder into the browse dialog, making this an easy and quick process. Not as easy and quick as in Windows or other OS's, but easier than entering shell commands every time! Here's the script: on run choose folder with prompt "Get contents of these folders:" default location (path to home folder) ¬ with showing package contents and multiple selections allowed open (result) end run on open droppedItems choose folder with prompt "Merge into this folder:" default location (path to home folder) ¬ with showing package contents set target to quoted form of POSIX path of result display dialog "How to handle existing files?" buttons {"Overwrite", "Cancel", "Skip"} default button 3 if (button returned of result) is "Overwrite" then set overwriteOption to "f" else set overwriteOption to "n" end if repeat with thisItem in droppedItems if (folder of (info for thisItem without size)) is true then get quoted form of POSIX path of thisItem try do shell script "cd " & result & "; /bin/cp -RP" & overwriteOption & " ./* " & target on error errorMsg number errorNum display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "OK" default button 1 with icon caution end try end if end repeat display dialog "Script finished." buttons "OK" default button 1 with icon note end open |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|