Can I copy files – but with certain restrictions?

I have just finished a large project, the archives of which involves about 5000 "base" files, stored on about 80 CDs and 50 DVDs, involving about 50,000 files in total. Each of the "base" files may have had up to 30 incremental versions. i.e. a certain text file may have undergone revision 23 times, and each revision was saved and archived to (probably) a different disk, with a different suffix – a, b, c and so on. But sometimes the suffix didn't change even though the file was edited. I might have done a bit more dust removal on an image and just overwrote the old file (already archived), and so the new one was archived on a different disk.
I now have 130 disks from which I would like to extract all the files and collapse them to one large archive that will probably span about 20 disks by the time I delete some files not needed. That way I can easily search for all versions of, say, GB097, by going to the particular DVD that has the "G" files on it. Up would come:
GB097
GB097a
GB097b
GB097b-1
GB097b-2
GB097c
... and so on.
This is what I would like to do:
1. Grab the first archive disk, open every folder, and copy all the files to the one folder on a hard drive.
2. Open the second disk and repeat step (1), but with these two provisos.
(a) If a file is identical to a previously copied file (maybe I archived it twice), the file isn't copied. However...
(b) If a file has the same name as a previously copied file, but the data within that file is different (i.e. I removed some dust from an image file, but left the name unchanged), I'd like that file to be copied with a numbered suffix, the same way that Trash treats identically named files.
Any suggestions how I could do this?

Back again. This is the Terminal output when run on my +Duplicates Copy+ folder:
Last login: Thu May 20 13:28:30 on ttyp1
Welcome to Darwin!
jenny-pearces-imac-g5:~ Jenny$ chmod +x /Users/Jenny/Desktop/Bash\ Test\ Documents/BashTest.txt
jenny-pearces-imac-g5:~ Jenny$ /Users/Jenny/Desktop/Bash\ Test\ Documents/BashTest.txt /Users/Jenny/Desktop/Duplicates\ copy/
/Users/Jenny/Desktop/Bash Test Documents/BashTest.txt: line 1: ${filePaths${count}}: bad substitution
/Users/Jenny/Desktop/Bash Test Documents/BashTest.txt: line 17: fileSum0=d41d8cd98f00b204e9800998ecf8427e: command not found
/Users/Jenny/Desktop/Bash Test Documents/BashTest.txt: line 1: ${filePaths${count}}: bad substitution
/Users/Jenny/Desktop/Bash Test Documents/BashTest.txt: line 17: fileSum1=d41d8cd98f00b204e9800998ecf8427e: command not found
/Users/Jenny/Desktop/Bash Test Documents/BashTest.txt: line 1: ${filePaths${count}}: bad substitution
/Users/Jenny/Desktop/Bash Test Documents/BashTest.txt: line 17: fileSum2=d41d8cd98f00b204e9800998ecf8427e: command not found
jenny-pearces-imac-g5:~ Jenny$
I'm not sure it's worth spending much more time on this. However, if you're prepared to keep posting, JJJ, I'll keep testing.
*SCRIPT AFTER THE EDIT*
#!/bin/bash
declare -i count=0
declare -a fileSum filePaths
# Main folder can be declared on the command line or if not then use /testpix
MainFolder="${1:-/testpix}"
# Set the internal field separator to newline to preserve spaces in file paths
IFS=$'\n'
# Use 'find' to create a list of files within the folders.
filePaths=( $( find "${MainFolder}" -type f \! -name ".*" ) )
# Get an MD5 checksum for each file's combined content of both data and resource forks
for file in ${filePaths[*]} ; do
fileSum${count}=$( cat "${filePaths${count}}" "${filePaths${count}}/rsrc" | md5 | cut -d'=' -f 2)
let count+=1
done
# For each file, check for a duplicate checksum and if found, move the matching file to the user's trash folder
# Rename files with duplicate names by appending #XX
for ((i=0;i<${count};i++)) ; do
[ -z "${filePaths[${i}]}" ] && continue
dupecount=1
for ((j=0;j<${count};j++)) ; do
[ -z "${filePaths[${j}]}" ] && continue
if [ "${fileSum[${i}]}" = "${fileSum[${j}]}" -a ${i} -ne ${j} ] ; then
mv "${filePaths[${j}]}" ~/.Trash && filePaths[${j}]='' && fileSum[${j}]=''
elif [ $(basename "${filePaths[${i}]}") = $(basename "${filePaths[${j}]}") -a ${i} -ne ${j} ] ; then
let dupecount+=1
dirname=$(dirname "${filePaths[${j}]}")
fullfilename=$(basename "${filePaths[${i}]}")
extension="${fullfilename##*.}"
filename="${fullfilename%.*}"
until [ ! -e "${dirname}/${filename} #${dupecount}.${extension}" ] ; do
let dupecount+=1
done
mv "${filePaths[${j}]}" "${dirname}/${filename} #${dupecount}.${extension}"
filePaths[${j}]="${dirname}/${filename} #${dupecount}.${extension}"
fi
done
done
exit 0

Similar Messages

  • I have protected pdf files. You can not copy things, but it is allowed to print. In the menu of the pdf it says you are allowed to print. I already printed lots of times the document. But today there is an error "The printer is not admittet to print these

    I have protected pdf files. You can not copy things, but it is allowed to print. In the menu of the pdf it says you are allowed to print. I already printed lots of times the document. But today there is an error "The printer is not admittet to print these pdf". Its new. Theres no problem with the printer. I can print word documents, internet pages etc. But today I can not print anymore my pdf document, although printing is allowed and only copying is forbidden.
    How to solve the problem with the pdf?
    Thank you.

    Hi Hans,
    There seems to be other restrictions in the document that's not allowing it to print.
    Would it be possible to share the document with me so that I can have a look?
    Regards,
    Rave

  • Downloaded certain files from my old computer on a memory stick.Have inputted stick into my new mac and can open PDF files but not xlr,aww or eps files.Is there a solution to this please?

    Transferred certain files to my new Mac from my old computer via memory stick.Can open PDF files but not xlr,aww or wps ones.The important ones are in xlr format.Is there a solution please?

    My guess is they don't care. Most likely they're illiterate and don't know what a colon is for. They probably think it's a little-used character. Remember: these are the people who don't know the difference between "deprecate" and "depreciate".
    I have the same colon problem as you do. But it's not the biggest problem I have encountered in Lion. If it was only that I'd be Mr. Delighted with Lion. There's worse than having a colon - uh -  that won't cooperate. A lot worse, in Lion.

  • How can i copy files from one external hard disk to another using macbook pro with retina display

    How can i copy files from one external hard drive to another using macbook pro with retina display?

    That's odd - if you open Disk Utility (Applications->Utilities) and select the disk(s), how are they formatted? If you're only going to be used with your Mac, they should be formatted as "Mac OS Extended (Journaled)".
    Clinton

  • On my imac, All of a sudden I am unable to send original emails with any attachments.  I can attach the file but when I try to send it, it won't send.  Also, if I am emailing back and forth as it gets longer, it no longer transmits

    On my imax, all of a sudden I am unable to send original emails with attachments of any size.  I can attached the file but when I try to transmit, it will not go.
    Also, if I am emailing back and forth, once there gets to be several threads, it will no longer transmit.  Any suggestions. I am using gmail in the apple mail system

    Mike,
    Are any of your other applications going wonky, or is it just Logic?
    I'm afraid I've never heard of this particular problem before, but if it were happening to me the first thing I would do is delete my "com.apple.logic.express.plist" file in Library>Preferences, then repair permissions in Disc Utility, and finally restart my computer.  Then I would launch Logic and see if the problem has been corrected.  It's amazing how much these two steps can accomplish.
    If that doesn't resolve the issue I would launch Logic and go to Preferences>Audio Units Manager to see if all my plug-ins are properly validated.

  • Downloaded acrobat reader 11 onto my Mac Book Pro, it can open the file but will not print. Get a message that says PDF cannot be printed, however, I forwarded it to someone else and they could print it, no problem. I called HP and spent an 1hour with the

    downloaded acrobat reader 11 onto my Mac Book Pro, it can open the file but will not print. Get a message that says PDF cannot be printed, however, I forwarded it to someone else and they could print it, no problem. I called HP and spent an 1hour with them and then called Apple support and worked with them for 3 hours. No one can figure it out. Is there something wrong with this version? the pdf was created in 2004. Do I have to pay to get Acrobat?

    Let me give you a slightly different perspective than everyone else here.  You are using an unsecured wireless network, which means that all your network traffic is easily available for viewing by anyone else using that network.  That's bad.  Very bad, for you, unless you absolutely trust everyone who lives within range of this network.  So stop doing it.
    As to the Mac not connecting, wireless networking is simply too complex for any reasonable answer without more information.  There are many possible error points, and as often as not it's the Mac that can connect and the Windows PC that cannot.  Since you can't give us any information about the configuration of the neighbor's network, and can't make any changes to it, we can't do much to help you troubleshoot it.

  • Hi Trying to download CS5 Design Premium. We have a copy on the Mac and want to put a second copy on the Macbook pro. Can download the file but when it is clicked the file give an error message "User access denied" and dumps the download. So hence I do no

    Hi Trying to download CS5 Design Premium. We have a copy on the Mac and want to put a second copy on the Macbook pro. Can download the file but when it is clicked the file give an error message "User access denied" and dumps the download. So hence I do not get an installation screen or a chance to enter the Licence no.

    Use another browser.
    Mylenium

  • Can't copy files to a network share but can copy folders...

    I frequently use a network share at work. I can view files off of it fine. I can erase files off it. I can copy folders to it.
    However, any time I copy any single file I get the following error.
    "The operation can’t be completed because you don’t have permission to access some of the items."
    This occurs for every file I've tried. From txt files to jpgs to docs. Everything gives that error and fails. I'm at a loss and it's totally killing my productivity.
    It's a linux based share and all permissions on that box are correct. My account can easily copy files from other machines. Also, the fact that files and modifications work on this computer seems to prove that as well. I think it's pretty apparent that the cause of this error is on my laptops end.
    I've verified my disk permissions. I have no clue what could be causing this.

    Look at this thread for discussion of this issue.
    http://discussions.apple.com/thread.jspa?threadID=2382501
    Search is your friend.

  • Mac OS X can not copy files...?

    I am very new to Mac OS X and I found it strange that I can not copy files from my hard drive (docs, spreadsheets) to a blank CD-ROM disk. I called the local Apple store and they said I have to buy a third party application to copy(burn) files to CD-ROM disks. I am not talking about copying copyrighted files, just plain old Word and Excel docs. Does anyone know if this is true? I have to get a separate application to do this? Thanks, Tony.

    You can certainly copy files to to a blank CD without extra programs. But once there is data on the disc, it becomes much more complicated to add data at a later date.
    Windows, however, had a proprietary CD filesystem that let you use the CD like a floppy disc, where you could add and "erase" files randomly.
    You can buy an inexpensive program called BurnAgain that does something similar on the Mac.
    http://freeridecoding.com/burnagaindvd/
    Frankly, though, I think CDs make bad floppy discs. There is much more chance for data corruption when they are re-written.
    I'd recommend an inexpensive USB Thumbdrive (Flashdrive). They come in all sizes and really do work like a giant floppy disk -- only much faster. They are dirt cheap. You can find one the capacity of a CD for about $10 or less. DVD-size flashdrives are now under $40 some places.
    The easy way to burn data (once) to a CD or DVD is to create a Burn Folder. Hold down the CTL key and click once on your desktop. You'll get a pop-up menu with a choice to create a New Burn Folder. Name the Folder what you want the Disc to be named. Then open the folder and drag the files or folders you want to Burn onto the burn folder. It will actually create links (aliases or shortcuts in Windows terms) to those items. Click on the burn button at the top of the folder and it will ask for you to insert a blank CD or DVD.
    You can discard the burn folder if you are through with it, because it just contains alias (shortcuts). But I must warn you that if you navigate into the subfolders of those shortcuts, you will be dealing with your actual files. So please, don't delete anything inside a folder inside a burn folder -- those are your real files!

  • Can't copy file from SAP-directory to FTP server

    Hello,
    I can't copy files from the SAP server to the FTP server. The file is created with OPEN DATASET and CLOSE DATASET commands and is placed in the SAP-directory S:\usr\sap\DEV\DVEBMBGS00\work.
    I can see and read the file with transaction al11, so I know it's there.
    But the FTP command always gives the same error:
    S:\usr\sap\DEV\DVEBMBGS00\work\[FILENAME] errno 22: invalid argument
    I can connect to the FTP, but the put command keeps failing. Somehow, the file in the SAP directory can't be read, it seems, even when
    Any ideas?
    Thanks in advance.
    Dave

    Ok, I found out that I have to use SAPFTPA as RFC destination type, instead of SAPFTP, otherwise the folders can't be located.
    But with SAPFTPA I can't seem to connect to the FTP server. I've tested the connection with sm59 and it works, but for the FTP it doesn't work. When I use SAPFTP as destination type, it still works.
    What can I do?
    Thanks.

  • How can I copy file/folders from and to hard drives? How can I have two or more windows of explorer so that I can drag and drop from one hard drive to another?

    Hi,
    I am a new customer (purchased last week) of MacBookPro (latest) and its my first ever Apple laptop.
    I am almost lost to find the operating tools.
    1. How can I copy files from hard drive to computer and vis-a-versa?
    2. Only can browse one but how can I have two or more browses at the same time like in MS windows?
    3. No right click works on track pad?
    4. Is there application/ program compatible to MS office? If so how much and how can I purchase?
    5. Is there AutoCAD program that is compatible to MS Window AutoCAD? and if yes how much and how can I purchase?
    I will very much appreciate if you could email me the with the solution/answers please.
    Regards,
    Khagendra Limbu

    1) For some reason this happens once in a while with FAT32 enabled external harddrives. I have no idea why this happens but it most easily solved by reformatting the drive. First make sure you've copied everything from the external drive to your internal harddrive. You've done this earlier so I assume you know how to do this.
    Now the reformatting part. Open Finder and go to Applications. Look for the folder called "Utilities". Click on it. In it you find a program called "Disk Utility". Click on it. Now look for the external drive. You probably see two entries for the disk. Click on the one that contains the name of the drive NOT the one that describes the disk (Like for example 320.07 GB Samsung S2 Portable Media).
    Now you see four tabs in the righthand part of the window. They're called "First Aid", "Erase", "RAID" and "Restore". Click on "Erase". This opens the tab with (amongst others) a dropdownbox (Format) and a textbox (Name) . In the dropdownbox select "Mac OS Extended (Journaled). Take note! This selection disables usage of the drive with Windows PC's. If your goal is to share the drive with Windows PC's select the MS-DOS FAT option.
    Enter a label for the drive in the textbox Name. Now click on the button "Erase". This will format the drive.
    Now when it's done you can copy back all the items you've copied to your internal harddrive earlier.
    2) Opening two windows like Explorer on Windows is opening two Finder windows on the Mac. Simply click on the background. In the menubar you items like 'Finder", "File", "Edit", "View", et cetera. Click on "File" and "New Finder Window". Do this two times. Alternatively you can click on the background and press CMD-N two times.
    3) You can right click on the trackpad. This however depends on if you've enabled the feature in System Preferences. In the topmenubar click on the Apple icon and select "System Preferences". Now look for Trackpad in Hardware. Click on it. You see three tabs with the names "Point & Click", "Scroll & Zoom" and "More Gestures". Select "Point & Click" and look for "Secondary Click'. Make sure it is checked and make sure it has written "Click or tap with two fingers" written beneath "Secondary Click". When you're done exit System Preferences. Now select the background and tap with two fingers on the trackpad. This should open the contextuel menu with options like "New Folder", "Get Info" et cetera.

  • Can't copy files to network client's folders

    We just switched from ARD 2.0 to ARD 3.0. ARD 3.0 is a great product - if it works. I can only copy files to ARD-clients, if I copy to the local hard disk, i. e. if it is a local client or if it is a network client and I copy to the top level of the volume. But if I copy files to the network client's desktop it doesn't work. I think the reason is that the network client's desktop is located on the server and not on the local hard disk.
    The same problem occurs if I use the new feature to copy files from or to a client using drag-and-drop with the observe window. It works with the client's local hard disk, but not with folders located on the server. This time there is no error message, but the message "waiting" - and the waiting never terminates.
    Has anybody a helping idea? Thanks!
    Greetings from the country of the football (soccer!) world cup!
    Horst

    I had the same problem, but I managed to fix it.
    In WGM check that the sharepoint of your users Home Folder is set to owner root with Read and Write permissions.
    I also created an ard_admin group in WGM and enabled open directory management on the client Macs. (Page 62 of the ARD admin Guide.)

  • Can't copy files to network share using migrated account

    Man this is so bizarre. I got a new MacBook Pro and used the Migration Assistant to copy over everything from the old MacBook Pro. Everything seems to work except I can't copy files to my desktop via a network share.
    What's totally bizarre about this is that I can delete and rename files from the network share! I can also drop into the command line and try copying - at first, I get "Operation not permitted", but if execute the command again, it works!
    In the Finder, when I try to copy a file, I get a window that says:
    "You may need to enter the name and password for an administrator on this computer to change the item named "xxx". If I click stop at this point, a zero-byte file is created on the target machine.
    If I click Continue, I get another window that says "The item "xxx" contains one or more items you do not have permissions to read. Do you want to copy the items you are allowed to read?
    If I click Continue, I get a final window that says "The operation cannot be completed because you do not have sufficient privileges for some of the items".
    Note that this also happens in the opposite direction when I connect to my notebook from my desktop.
    Also note that this only happens with the account that was migrated. I can successfully copy files if I setup a new account.
    I've repaired permission on both machines. My old account on the old MacBook Pro still works fine, btw.
    I've seen other posts with people having this problem, but I've yet to see a good solution.

    I had the same problem, but I managed to fix it.
    In WGM check that the sharepoint of your users Home Folder is set to owner root with Read and Write permissions.
    I also created an ard_admin group in WGM and enabled open directory management on the client Macs. (Page 62 of the ARD admin Guide.)

  • Can't copy files from mounted DMG. What's up??

    So all of a sudden, I can't copy files from mounted DMG files. It's strange because if there is one file and I drag it to another location, like desktop, it won't copy. If I drag 2 files from the mounted DMG to the desktop one of them copies. If I drag 3, then 2 copy... it's always all but one of the files... never all of them.
    I've tried repairing permissions but nothing works. I'm at a loss...
    thanks
    D
    iMac Core Duo 17", 1.5 gig RAM   Mac OS X (10.4.8)  

    Try holding option when you drag the files. This tells the mac to move the files to the desktop of your computer not the desktop folder of the DMG (usually a hidden folder)
    If that doesn't work it may be that you need administrative privileges to move the files. Make sure you are logged on as as an administrator by selecting the account tab in system preferences and making sure it says "admin" under your user name. Log on to or create an administration account then try moving the file.
    Hope this helps, let me know
    Thom

  • Can't copy file to network drive as "The operation can't be completed because the [Filename] is in use

    Following upgrade to Yosemite I now can't copy files from iMac to my network HDD in external media center. I have iMac connected by wi-fi to airport extreme and media center connected to airport extreme by cable. I can see the HDD as a network drive on my iMac and can initiate the copy but right when copy process is finished I see "The operation can’t be completed because the [Filename] is in use". I am trying to copy different media files downloaded from internet which are not used by any program and stored on my hard drive. I actually can copy small files of 1mb and it works but anything above 20mb is halted. I can also move/copy/delete the file on iMac. Cant understand the nature of the problem. I tried to format external HDD as EXT2/EXT3/NTFS but same outcome.
    OS X Yosemite 10.10.3 | iMac late 2009 | Apple Airport Extreme | Dune HD Base 3D mediacenter

    Have you tried a restart or logging out/in?
    Some more ideas.
    Re: The operation can’t be completed because the item “ " is in use.

Maybe you are looking for

  • Images are not showing up on my macbook pro

    I just noticed that images are not rendering when I'm trying to upload them via my Macbook Pro. I also can't see some videos or images on websites.  I do have Flash player installed.

  • Migration from  Sun to HP Unix to Windows

    Hi , There is hardware and OS migration activity is scheduled in my current project. To give you the detail, BI system will be migrated from SUN to HP servers and OS will be changed from Unix to windows. I am asked to test the system to check that an

  • TCP wrappers not logging?

    I recently opened up my SSH server to the world (so i can log in from outside my home network to my server). Did some reading up, found out TCP wrappers acts as an intermediary to decide whether or not a request for a given application gets acknowled

  • Show All History Is Blank?

    I have only recently noticed this problem, when I am clicking into my Show All History it turns out to be blank and my bookmarks aren't showing up either they show up when I click Bookmarks tab but not in my Library under All Bookmarks. I have double

  • CS4 Exporting Trouble - Audio / Video Sync

    I'm having a lot of trouble exporting from Premiere CS4. I have a 5 minute video project shot in 1920x1080 and I'm just trying to export it into a format that can support its HD. When I try the H.264 BluRay preset, though, the audio and video are hug