Move a file to external disk and remove the original

This is a script that was supplied to me on these forums it has been working well, but all the transferring of the files took place locally so a 'Move' command does it eactly what it says, however I now need to move it to an external drive, as a result it leaves trace of the original file.
How can I make it MOVE and remove the origial File please?
set fileMatrix to {¬
          {folderName:"BHS", prefixes:{"BH70", "SM70", "AL70", "BH11"}}, ¬
          {folderName:"Bu", prefixes:{"BU40", "BU11"}}, ¬
          {folderName:"Ca", prefixes:{"CW"}}, ¬
          {folderName:"Da", prefixes:{"ES20", "AM20"}}, ¬
          {folderName:"Di", prefixes:{"DV25", "DV11"}}, ¬
          {folderName:"Do", prefixes:{"DJ30", "RA30", "DJ11"}}, ¬
          {folderName:"In", prefixes:{"GT55", "CC55"}}, ¬
          {folderName:"Fr", prefixes:{"FR10", "FR11", "FR17"}}, ¬
          {folderName:"No", prefixes:{"TM17", "NN_"}}, ¬
          {folderName:"Ma", prefixes:{"MA65", "MF65", "FI65", "MC65", "MH65", "MB65"}}, ¬
          {folderName:"Pr", prefixes:{"PR_"}}, ¬
          {folderName:"To", prefixes:{"TM15", "TM11"}}, ¬
          {folderName:"Wa", prefixes:{"WA35", "WA11"}}, ¬
          {folderName:"Se", prefixes:{"SE_"}}, ¬
          {folderName:"Mik", prefixes:{""}}}
tell application "Finder"
  --set theHotFolder to ((path to pictures folder) as text) & "HotFolderDone"
          set theHotFolder to folder "StudioA:Users:StudioA:Pictures:HotFolderDone"
  --set foldericon to ((path to pictures folder) as text) & "Icons:Rejected Folder Done"
          set foldericon to folder "StudioA:Users:StudioA:Pictures:Icons:Rejected Folder Done"
  --set fakeTrash to ((path to home folder) as text) & "FakeTrash"
          set fakeTrash to folder "StudioA:Users:StudioA:FakeTrash"
set a to alias "Scratches:Workings"
          repeat with matrixItem in fileMatrix -- look for folder
set destinationFolder to (folders of a whose name starts with folderName of matrixItem)
                    if destinationFolder is not {} then -- found one
                              set destinationFolder to first item of destinationFolder -- only one destination
                              set theFolderName to name of destinationFolder
                              repeat with aPrefix in prefixes of matrixItem -- look for files
                                        repeat with startFile in ((files of theHotFolder whose name starts with aPrefix) as alias list) -- move files
                                                  try
  move startFile to destinationFolder
                                                  on error
  activate
                                                            display dialog "File “" & (name of startFile) & "” already exists in folder “" & theFolderName & "”. Do you want to replace it?" buttons {"Don't replace", "Replace"} default button 2 with icon 1
                                                            if (button returned of the result) is "Replace" then
                                                                      set {fileName, t_ext} to {name, name extension} of startFile
                                                                      if exists file fileName of fakeTrash then -- and it also exists in the fakeTrash Folder.
                                                                                set name of file fileName of destinationFolder to "this is a unique name" -- or whatever
                                                                                set newName to my getUniqueName(fileName, t_ext, fakeTrash)
                                                                                set movedFile to move file "this is a unique name" of destinationFolder to fakeTrash
                                                                                set name of movedFile to newName
                                                                      else -- not exists in the fakeTrash Folder.
  move file fileName of destinationFolder to fakeTrash
                                                                      end if
  move startFile to destinationFolder
                                                            else -- "Don't replace"
                                                                      if not (exists folder "StudioA:Users:StudioA:Desktop:Rejected Folder Done") then
                                                                                set theLastFolder to duplicate foldericon to desktop
                                                                      else
                                                                                set theLastFolder to folder "StudioA:Users:StudioA:Desktop:Rejected Folder Done"
                                                                      end if
                                                                      delay 0.5
  move startFile to theLastFolder with replacing
                                                            end if
                                                  end try
                                        end repeat
                              end repeat
                    end if
          end repeat
          try
                    if (count theLastFolder) is 0 then delete theLastFolder
          end try
end tell
to getUniqueName(theName, theExtension, someFolder)
     check if someFile exists in someFolder, creating a new unique file name (if needed) by adding a suffix
          parameters -          theName, theExtension : a file name and his name extension
                              someFolder : a folder (finder item or alias)
          returns :     a unique name
          set {counter, suffixes, divider} to {0, "abcdefghijklmnopqrstuvwxyz", "_"}
          if theExtension is not "" then set theExtension to "." & theExtension
          set theName to text 1 thru -((length of theExtension) + 1) of theName -- just the name part
          set newName to theName & theExtension
          tell application "Finder" to set theseNames to name of items of someFolder
          repeat while theseNames contains newName
                    set counter to counter + 1 -- hopefully there aren't more than 26 duplicates (numbers are easier)
                    set newName to theName & divider & (item counter of suffixes) & theExtension
          end repeat
          return newName
end getUniqueName

I do not have the time to read through your whole script and give specific answers, but the general principle is fairly easy.  You're moving with the Finder, so your move command is going to be of the form:
tell application "Finder"
  move file xxxx to folder yyyy
end tell
For cross file system moves (which are as you point out actually duplications) just add a line after each move that sends the old file to the trash:
tell application "Finder"
  move file xxxx to folder yyyy
  delete file xxxx
end tell
the Finder has an empty trash command that you can use at the end of the script if you like.
One gotcha: because move has two different behaviors, the second code block will throw an error if you try to use if for a local move (it will move the file properly, then try to delete the file it moved, which is obviously no longer there).  For clarity, I'd use duplicate rather than move for if you're working across file systems.  That's what you're actually doing, and if you use the move command you may confuse yourself when you come back to look at the script a year down the road.

Similar Messages

  • How can I use two different PC's with Lr5.5 to manage and process my photos stored on external disk, and exchange the analysis between these two computers?

    I operate on two computers and would like to be able download  Lr jobs done on my laptop,  to my stationary PC, also used to process other images, all stored on the same external disk.
    In other words I want to process may photos on two PCs and to to have access to all analyses from one or even better from both computers independently.
    Samek.

    You need to put your photos AND LR catalog file (.lrcat) on the external drive, and make sure the external drive has the same device name or drive letter on both computers.
    I have been using LR this way for several years and it works fine as long as you MAKE A BACKUP of the external disk somewhere, in case you lose or drop/damage the external drive which is easy to do.  Nightly, or sometimes more than once a day, I copy all changes from my working external disk to another similar-sized external disk.  I have lost a disk, once, and dropped/destroyed a disk, once, but recovery is as easy as using what used to be the backup disk as the primary one, and buying a new disk for the backup device.  It does take some hours to copy the 1TB of photos to the new backup disk, but once that is done, it usually only takes a few 10s of minutes or less to copy what is new or changed each night.

  • How do I move my library to an external drive and delete the original on my local hd

    i have final cut x and yosemite. im running out of space on my hard drive on my mac book pro. i would like to copy all my old libraries to an external storage space and then delete the library from my local hard drive. im nervous to do it incase i lose the files. what is the best way to do this? thank you in advance

    If the libraries contain all the media - which is the default - then all you have to do is drag them to the external drive using the Finder.
    In any case, start by dragging a library to the external.
    Now open that library in FCP X, select it under "Libraries" and open the Inspector - you should see something like the picture below.
    Most likely, for Media, the location is "In Library", which means that most or all content should be inside the library. To make sure, click "Consolidate". This will copy anything that may have been stored outside the library, so that the library is completely self-contained.
    You can now safely delete the copy of the library from the internal drive.
    Tip: one of the things that uses most space is transcoded media - especially optimized media. You can safely delete that by going to File->Delete Generated Library Media.

  • How do I change a primary admin from Teams and remove the original primary admin?

    I have added another admin to Creative Cloud for Teams, and need to change that user to primary admin, and then remove my Adobe account (the original primary admin) from the Teams group.  Is it possible to do this?

    Currently you cannot change the primary admin on a CCT membership. As a workaround, follow these steps:
    Cancel the existing team membership: You can cancel the membership without any penalty. The accounts for team members change to trial mode. Members can still access their saved data in the cloud storage. To cancel the membership, click theChat Now button at the bottom of this page to initiate chat with a live agent.
    Buy a new team membership; use the Adobe ID for the new primary admin.
    Reinvite team members using the new primary admin account.
    The team members have to accept the invitation and log in to the Creative Cloud Desktop app again. Their apps are activated under the new team account. 
    from adobe... basically... suck it up

  • Lr Mobile. Working with various Catalogs. Picture on portal are erased when Catalogs Backed to external HD and removed from MacBook.

    So I work with various Catalogs on my MacBook. I believe most everyone has the same workflow. Creating Catalogs are a great way to improve the performance of Lr and a great tool for archiving.
    The problem is the following: When backing up these Catalogs to an external HD and removing the Catalog from the MacBook. All of the pictures synched to Lr Mobile from these Catalogs are erased.
    This is uncool. I think Lr Mobile at the very least should display a low quality JPG as Lr Desktop application does.
    Here is a toke, I noticed on my iPhone that even though the pictures are gone, my used memory remains high. I tried clearing cache but it didn't move the needle.
    So it seems as Lr Mobile knows there were some pictures synched, and recognizes that these pictures are no longer present, but fails to erase them from memory.
    1) Need Low quality JPGs on Lr Mobile to show pictures of your synched catalogs that are not longer the catalogs been worked on.
    2) Lr Mobile (iPhone?) memory issues.
    Thanks,
    Daniel

    So I work with various Catalogs on my MacBook. I believe most everyone has the same workflow. Creating Catalogs are a great way to improve the performance of Lr and a great tool for archiving.
    The problem is the following: When backing up these Catalogs to an external HD and removing the Catalog from the MacBook. All of the pictures synched to Lr Mobile from these Catalogs are erased.
    This is uncool. I think Lr Mobile at the very least should display a low quality JPG as Lr Desktop application does.
    Here is a toke, I noticed on my iPhone that even though the pictures are gone, my used memory remains high. I tried clearing cache but it didn't move the needle.
    So it seems as Lr Mobile knows there were some pictures synched, and recognizes that these pictures are no longer present, but fails to erase them from memory.
    1) Need Low quality JPGs on Lr Mobile to show pictures of your synched catalogs that are not longer the catalogs been worked on.
    2) Lr Mobile (iPhone?) memory issues.
    Thanks,
    Daniel

  • HT204382 what software do i need to play movies on avi file . have connected a external memory disk and all the movies are in avi format.

    What software do i need to install in order to be able
    to play movies in .avi format.
    have connected an external memory and all the entertainment
    files are in .avi format.
    Ansver i get : does not support

    VLC is a good choice. While I don't know if it will play your files, Perian is a helper app for Quicktime which allows you to play a lot of things in the Quicktime Player.
    There is also Flip4Mac which allows you to play windows media files in Quicktime.
    Finally, note that the extension on a video file doesn't really tell you what you need to play it. The .avi, .mpg, etc. is only the wrapper around the actual video. The video is encoded by some means and needs to be decoded. The video inside the .avi can be encoded in one of many different schemes.
    VLC, Perian, Flip4Mac, and many others, are all able to decode various flavors of encoding. Having all of those in your toolbox will help to allow you to play most of the things you'll find.

  • I have transfered all my library on an external hard disk and lost the itunes library files.

    I transfered all my library on an external hard disk and lost the itunes library files. Itunes created new ones but I lost all the playlists.
    How can I copy the playlists presents on the Iphone directly on Itunes ?
    If I want to syncronise now, I lost all playlists datas.

    Hi,
    I did the same XP to Windows 7 upgrade about 18 months ago.   I decided to keep iTunes permanently on the external drive than the c drive to save c: drive space. 
    ITunes database has pointers to MP3 files located in Artist's directories.  If you want to use a different location than the default C:\ drive for iTunes, then you need to recreate the Itunes database by deleting all songs in iTunes, then change the default location for iTunes files to your external drive.  Then import the MP3 files from the external drive into the empty iTunes database through the iTunes import facility.  
    If you screw up the timing of the import and find you have multiple iTunes directories (instead of just the default location), then iTunes has a new feature to consolidate all iTunes MP3 files back into the central default location.  In iTunes, FILE, LIBRARY, ORGANIZE LIBRARY, then CONSOLIDATE FILES.
    To change the default directory for MP3 files, in Tunes go to EDIT, PREFERENCES, ADVANCED and then CHANGE the location to where you want the Itunes MP3 files to be located (including the iTunes subdirectory under which all the artist directories are held.  Mine are on the F: drive or whatever your computer states is your drive assignment for the external drive.
    Note iTunes 10.5 has many problems that Apple hopefully are working on....we seem to have gone backwards on working components in this iCloud based release.  So maybe keep on using old computer until 10.6 is released.
    Enjoy
    Steve Mc (Sydney AUSTRALIA)

  • My Xtreamer media player won't read srt sub files downloaded from my iMac and stored in a 1Tb seagate external disk. However, the Xtreamer Elvira media player will read all the .avi files I have loaded in the external disk. Any ideas?

    My Xtreamer media player won't read srt sub files downloaded from my iMac and stored in a 1Tb seagate external disk. However, the Xtreamer Elvira media player will read all the .avi files I have loaded in the external disk. Any ideas?

    I am experiencing the same issue with a new external DVD burner, a Sony DRX-840U. When I load a CD into this external drive it appears in iTunes but when you go to import or play the CD iTunes indicates playing or importing for each individual track for just a moment. The end result is that nothing is ever imported or played. I am experiencing this on two different systems. One a notebook running Win2K and the other a desktop running XPpro. If I use the internal DVD drives on either of these systems everything work just fine. Yet I am able to use this new external DVD drive with every other application. For example Window Media Player has no problem playing or importing the same CD that iTunes fails on. The last person indicated that if one set the DVD drive in question to be the drive of choice under preferences>advanced>burning that all was ok. I my case this Sony external drive is the drive listed as the drive of choice for burning yet the issue still exists.
    As this appears to be an issue that others are also experiencing help from Apple Tech Support would be greatly appreciated.

  • I am trying to get space on an external hard drive which has some old time machine back up files that I do not need but can not eliminate, even by going into the time machine, clicking on the backup file to be eliminated and using the drop down eliminate

    I am trying to get space on an external hard drive which has some old time machine back up files that I do not need but can not eliminate, even by going into the time machine, clicking on the backup file to be eliminated and using the drop down menu with the gear box symbol to eliminate

    I cannot find this 300GB "Backup" in the Finder, only in the Storage info when I check "About This Mac".
    You are probably using Time Machine to backup your MacBook Pro, right? Then the additional 300 GB could be local Time Machine snapshots.  Time Machine will write the hourly backups to the free space on your hard disk, if the backup drive is temporarily not connected. You do not see these local backups in the Finder, and MacOS will delete them, when you make a regular backup to Time Machine, or when you need the space for other data.
    See Pondini's page for more explanation:   What are Local Snapshots?   http://pondini.org/TM/FAQ.html
    I have restarted my computer, but the information remains the same. How do I reclaim the use of the 300GB? Why is it showing up as "Backups" when it used to indicate "Photos"? Are my photos safe on the external drive?
    You have tested the library on the external drive, and so your photos are save there.  
    The local TimeMachine snapshot probably now contains a backup of the moved library.  Try, if connecting your Time Machine drive will reduce the size of your local Time Machine snapshots.

  • After writing an html report on a floppy disk and removing it, labview shows an error message window: disk not present

    after writing an html report on a floppy disk and removing it, labview shows an error message window: disk not present.
    My pc is based on asus motherboard. Labview 7 and Windows 2000 sp4 installed.
    The error message continue also if i stop the application that generated report on a: .
    I've got this problem only on a pc: on other machines i don't have this problem (Labview only continues to access floppy but it doesn't show any window).
    Find below an example: first press the button to create a report on a: then remove the floppy, after 30-35 sec i've got the error message
    Attachments:
    prova.vi ‏55 KB

    Hi,
    I tried your vi: I don't get any error message after removing the disk but LV7 keeps on accessing the drive at regular intervals even if you stop the vi and close it!!! This is not supposed to happen.
    The only way to stop it is exit LV7.
    If you don't use the file dialog and you wire a full path, you don't get any problem.
    I also created a very simple vi that conditionally writes a text file on a: and I got the same behaviour.
    This problem occurs only with LV7, I tried the same examples in LV6.1 and everything was fine.
    If anybody wants to try I attach this simple example,
    Alberto
    Attachments:
    salva_testo1.vi ‏22 KB

  • When I check my boot SSD drive using Disk Utility under Mavericks, I often get "Incorrect number of extended attributes" errors.  But if I boot off an external drive and check the same SSD, no errors are reported.  Is this a bug in Mavericks?

    When I check my boot SSD drive using Disk Utility under Mavericks, I often get "Incorrect number of extended attributes" errors.  But if I boot off an external drive and check the same SSD, no errors are reported. 
    This happens not just with the SSD in my Mac Mini, but with another SSD in my MacBook (both now running Mavericks).  So far as I know, all of the kit I am using is in good order (despite the file corruption reports).  So I am beginning to wonder if it could be due to a bug in Mavericks?  Both SSD drives have been formatted to MacOS Extended (journaled) format.  Should I have used a different format, I wonder?
    Has anyone else encountered this issue?
    Does anyone have a solution?
    Or an explanation that might help my investigation of the issue?
    Thanks guys,

    I understand that the Corsair Force 3 is not one of the SSD drives that are supported on Apple Macs. 
    I did try downloading and using Trim Enabler, but the error message came up both when it was off and when it was on.
    I understand that not everyone thinks Trim Enabler is a good program, though there is a new version out now, so I may give it another try.

  • When copying Itunes to an external drive, how do I get iTunes to feed from the file on the external drive and not the computer/

    I've already copied my iTunes folder onto my external hardrive. I'm having problems getting iTunes to pull the information from the external hardrive and not the computer's internal one, though. Any suggestions on how to get it to work?

    iTunes works off of an ITL file in the iTunes folder
    instead of dragging the folder out of the external hardrive and onto the desktop just do this
    -hold shift key and double click iTunes to open it up
    -you will get a prompt asking to create a new library or choose library, click choose library
    -an explorer window will open up and you are going to navigate to the external hard drive and open the iTunes folder
    -in the iTunes folder you are going to find a file that doesn't look like a folder but a page with a corner folded on it that is your iTunes library file
    -double click the iTunes library file and your library will appear and you are good to go
    WARNING: this is a good method for making sure your music doesn't take all of your computer's storage but keep in mind if you remove the external hard drive from the computer you may have issues accessing the library example next to the song titles

  • Where do the MEDIA FILES live after I import them from camera to iMovie (Mac Mini OS X 10.9.2)?  I need to MOVE MEDIA FILES to external hard drive.

    Where do the MEDIA FILES live after I import them from camera to iMovie (Mac Mini OS X 10.9.2)?  I need to MOVE MEDIA FILES to external hard drive.

    Hello bbryson68,
    Thanks for using Apple Support Communities.
    From your post I understand you're wanting to move iMovie project and event data to another drive.  I found the following information in the iMovie help that answers your question.
    Copy or move projects, events, or clips between libraries or storage devices
    Connect a storage device that contains the target library to your Mac, or copy the target library to your Mac.
    Choose File > Open Library, and choose an option from the submenu.You can choose from recently opened libraries, locate an existing library on your Mac, or create a new library.The selected library is opened in the Libraries list, with the first event selected and its contents displayed in the browser.
    In the Libraries list, select the event that contains the item you want to move or copy.
    In the browser, select the item you want to move or copy.Tip:  To select multiple clips or projects in the same library, hold down the Command key as you click the items you want to select, or drag a selection rectangle around the items.
    Do one of the following:
    To move items between events or libraries: Drag the clip or project to another event or library.
    To copy items between events or libraries: Option-drag the clip or project to another event or library by first starting to drag and then holding down the Option key as you drag.
    Work with multiple libraries
    http://help.apple.com/imovie/mac/10.0/#mov3fa25bae7
    Take care,
    Alex H.

  • I am using both PSE 13 and Lightroom 5.  When I use Lightroom as an external editor and save the photo, it shows up in PSE13 as an edited file but does not look any different.  Why doesn't it appear edited?

    I am using both PSE 13 and Lightroom 5.  When I use Lightroom as an external editor and save the photo, it shows up in PSE13 as an edited file but does not look any different.  Why doesn't it appear edited?

    People who have Photoshop, but don't have Lightroom, need ACR so that they can use Raw files. Without ACR they could do nothing with those (they may also like having ACR so that they can work on other kinds of image using the same kinds of adjustments and techniques, as are used with Raw files).
    People who have Lightroom, can get access to Raw files regardless whether ACR is present or not. They can use Lightroom on other kinds of image also, using the same methods. LR can pass images directly into Photoshop without passing via ACR (or else does so transparently, which amounts to substantially the same thing).
    ACR does not, strictly speaking, even need to be installed for this external editing to happen. In fact, not even PS needs to be - since a different image editor can be used instead, while still retaining the Adobe Raw conversion etc.
    Lightroom "subcontracts out" specialised external tasks, in this workflow, but is still your "main contractor": the image is otherwise located, viewed, managed, adjusted/presented and output entirely using LR.
    So IMO we can divide image processing into:
    operations that involve pixels and layers and layer masks and adjustment layers etc (of the kind done inside Photoshop)
    operations that involve parametric edits (of the kind done in ACR where you are not using a Lightroom based workflow; otherwise, done inside Lightroom)
    When PS is called in, that's because those tasks are impossible or unsuitable to do in Lightroom. But those tasks can't be done in ACR either - by definition, since LR and ACR have exactly the same image processing "feature set".
    Lightroom is irrelevant to the Bridge + ACR + PS workflow. This workflow requires both your PS and your ACR to be current enough, to support your Raw format etc.
    ACR and Bridge are irrelevant to the LR + (image editor) workflow. It is in this case, only LR which needs to be current enough to support your Raw format etc.
    RP

  • How do I find bad music files?  I have thousands of files, but some are bad.  When I try to load them into iTunes, it just spins.  I need a routine to identify and remove the bad files.  Any ideas?

    How do I find bad music files?  I have thousands of files, but some are bad.  When I try to load them into iTunes, it just spins.  I need a routine to identify and remove the bad files.  Any ideas?

    Hi ajoddo20,
    Welcome to the Apple Support Communities!
    You can use Home Sharing to import music and other media from one computer to another. Please use the instructions and information located in the attached article for information on how to complete the process. 
    iTunes 11 for Mac: Use Home Sharing to import items from another iTunes library
    Cheers,
    Joe 

Maybe you are looking for

  • Dynamic Text and Masking

    I have Dynamic Text in a Movie Clip on the timeline. Text shows up just fine without Mask. When I add a Mask Layer to the Movie Clip the Dynamic text dissapears. Can anyone shed some light why? Thanks

  • Acrobat Std. 9.5.5 Quit every 10 to 30 seconds!

    I work with Adobe Acrobat 9.5.5 Std. and every 10 to 30 sec the programm quit without an error message! i read something about online activation problem but i dont know how to solve this problem :-( pls help me and sry for my english

  • Difference between Web Service Developer and Web Compononent Developer?

    What's the difference between Web services Developer and Web Component Developer? What's their job description. I'm aiming to be a web application developer. Which track should I follow?

  • Importing a 3CD opera so that all the tracks are sequential in one playlist

    I have a 3CD opera. Each Cd starts it's track numbering with 1, 2, 3, etc. When I import the cds I either have 3 separate playlists - one for each disk - or if I put them together I have tracks 1, 1, 1, 2, 2, 2, 3, 3, 3 - etc. I gather I can renumber

  • Spotlight search for emails outside of iMail

    Hi all, By default, spotlight searches in iMail. I use another email client (Airmail) and I would like to include it in spotlight searches. Is that possible? Thanks