File Move and Rename Workflow and/or Script

This seems to be a simple workflow to create, but it isn't working for me. I want a workflow and/or script that will move screenshots from my desktop and place them into a folder. Secondly, I want these images to be renamed from "Picture #" to "Screenshot #" when placed in the folder. I also want future images placed in this folder to be named sequentially without any problems. For instance, if Screenshot 1, Screenshot 2, and Screenshot 3 are present in the folder after the workflow is ran once, the next file should be named Screenshot 4 when the workflow is ran again. Can anyone offer any assistance in this matter? I would greatly appreciate it.

If all you are doing is renaming and moving screenshots, then a regular AppleScript should do. Copy and paste the following script into the Script Editor and save as an application (uncheck the Startup Screen option). When it is first run it will ask for the destination folder, but after that it will use the same folder (until the script is recompiled, anyway).
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px; height: 340px;
color: #000000;
background-color: #FFDDFF;
overflow: auto;"
title="this text can be pasted into the Script Editor">
-- rename and move screenshots from the desktop to the specified folder
property ScreenshotFolder : (path to desktop) -- the default folder where the screenshots are created
property ScreenshotExtension : ".png" -- the default screenshot extension
property DestinationFolder : missing value -- the folder to move to
on run
if DestinationFolder is missing value then set DestinationFolder to (choose folder)
tell application "Finder" to get files of ScreenshotFolder whose name begins with "Picture " -- get screenshots
repeat with AnItem in the result -- do stuff with each item
GetUniqueName for ("Screenshot" & ScreenshotExtension) from DestinationFolder
tell application "Finder"
set the name of AnItem to the result -- rename
move (ScreenshotFolder as text) & the result to DestinationFolder -- move
end tell
end repeat
end run
to GetUniqueName for SomeName from SomeFolder
check if SomeName exists in SomeFolder, creating a new unique name if needed
parameters - SomeName [text]: a name.extension to check for
SomeFolder [mixed]: a folder to check
returns [text]: a unique name
set {Counter, Divider} to {"01", " "}
set Here to -(offset of "." in ((reverse of text items of SomeName) as text)) - 1
set TheName to text 1 thru Here of SomeName
if Here is -1 then -- no extension
set TheExtension to ""
else
set TheExtension to text (Here + 1) thru -1 of SomeName
end if
set NewName to TheName & Divider & Counter & TheExtension -- always add a suffix
tell application "System Events" to tell (get name of items of folder (SomeFolder as text))
repeat while it contains NewName
set Counter to text 2 thru -1 of ((100 + Counter + 1) as text) -- increment suffix with leading zero
set NewName to TheName & Divider & Counter & TheExtension
end repeat
end tell
return NewName
end GetUniqueName
</pre>
I added a leading zero to the number suffix so that the items sort properly. Note that if one of the renamed items is removed, a new screenshot will take it's place (the suffix starts at the beginning each time). If this isn't desired, the script can be tweaked to remember the last suffix number.
HTH

Similar Messages

  • Make a audio controller file move with a pan and zoom.

    I am using a few folio overlays for a digital publication.
    I have an image that uses the pan and zoom overlay.
    I would like to add several play buttons for audio that are linked to the image so when you pan the image the audio files move with it.
    So far I can only get the audio controller file to be static and the image move under it.

    Here's a little trick for you. Before creating a scrolling frame, group the
    text frame with a small no fill/no stroke frame. Now you have group in the
    frame, you can drag additional objects in using the layers panel.

  • PSE5 organizer tracking deleted and renamed folders and removing orphan thumbnails

    If files are deleted or renamed within a folder that's being watched by organizer, the changes made through explorer or any other program don't seem to ever get reflected in Organizer. For example, I deleted an entire folder of junk photos through Windows. They still show in Organizer. How do I tell Organizer to re-scan the folder and remove orphan thumbnails from the catalog? The only thing I've been able to do at this point is to highlight them all and delete them. That's not bad for a single folder, but is a pain when I've done a lot of renaming, reorganizing, and creation and deletion of folders and subfolders under the watched folder.
    I've used a program called Thumbs Plus for years, and it has an option "remove orphans" that you can do globally, or on a folder and its subfolders. I'm wondering if there's something similar in PSE.

    Yes, I realize that in an "ideal" world we could do absolutely all of our organizing in "organizer" but I just can't see that becoming a reality. We have different users on this computer and there are certainly going to be times when we're already working in another program, including Windows Explorer. One would think that if Organizer is monitoring a folder it would detect all changes, or at least have a manual "rescan folder" or "remove option of some sort to help get the real files back in sync with the catalog. Hmmm. I'm still using eval mode and not sure that I like this part! Perhaps the next version will do better in this regard.

  • Why do images unlink themselves to the current catalogue and rename themselves in the file folder?

    Can someone tell me why images unlink themselves to the current catalogue and rename themselves in the file folder
    Message title as edited by: Brett N

    proupicture wrote:
    BTW when i remove the "2-2-2" Lightroom then will recognize it....just a pain to do
    As web-weaver alluded to previously, the -2-2-2 is the mark of Lightroom renaming a file to resolve a filename conflict. - in a nutsell: if it needs to write a file, but the name is already taken (a file of that name already exists in the folder) it appends -2 (yes, it may be -3 or -4 too depending - but I shan't explain all here).
    For the record, I never want Lightroom to append a -1, -2, -3 ... to *any* of my files, be they catalog, photo, or export... This feature is for people who use computers without understanding about files, or folders, or disks... - which is cool, but in my case, any time Lr is doing that it's the wrong thing to do.
    i.e. if there is a filename conflict - I want to be involved in resolving it.
    Worth noting: there are 2 things that can happen in Lightroom:
    1. Proper automatic resolution of legitimate filenaming conflicts (by appending -digit uniqueness suffix).
    2. Improper automatic resolution of un-real filenaming conflicts due to Lightroom bugs/confusion. e.g. renaming a file will sometimes add the suffix even though there is no filename conflict.
    Bottom line: If images are unlinking themselves and renaming themselves (and you didn't do it, inadvertently outside Lightroom, or in...), then there is a bug in Lightroom. If that is the case, then such bug may very well have been set off by some anomaly in your computer/file-system/catalog... - worth considering that.
    If this is a bug in Lightroom, consider reporting it via the link below, along with as much info as you can about how it happened, how to reproduce...
    http://feedback.photoshop.com/photoshop_family/topics/new
    Rob

  • Movement type - accounting posting and value update

    Hi,
    1) Could some one let me know the exact check box or setting in movement type master data that makes value postings to FI.
    I mean when I use a movement type, I do not want any value updates.
    2) Also, when a material uses standard price as price control, system also makes an update to MAP price for statistical purposes. I observed this statistical update to MAP price field happens only for movement types 101 and 102. Could some one explain me why it does not happen for other movement types and what I need to do for enabling system to update MAP price for statistical purposes even for other movement types.
    Thanks,
    SKD

    Could some one let me know the exact check box or setting in movement
          type master data that makes value postings to FI
    The control is in OMJJ.  Once you go to OMJJ, key in movement type 101 and execute.  There you can see some tabs to your left screen.  If you double click on Account Grouping,  you can see a tab on the last Check acct.***.  Wherever the box is checked, those relevant entries will be posted to FI. 
    What you can do is copy this standard movement type, rename it and make changes here.
    thanks
    G. Lakshmipathi

  • My iTunes library data file has been renamed temp file.tmp

    Can I just rename it iTunes Library? It is a functioning iTunes Database file and it works perfectly well - it is just weird!
    I have iTunes 7.6.2 (9).
    My library resides on my external hard drive.
    In my iTunes folder on that drive, I also find Temp file.tmp.xml and iTunes Library.xml.
    I believe this got screwed up on May 31st (that is the last modified date on iTunes Library.xml) when I was showing a slide show in iPhoto which used music from my iTunes library. At one point I disconnected the external drive to use the USB cable to upload photos to iPhoto from another camera.
    I have read through a lot of the discussion topics about library issues and temp files, but cannot find anything that deals with this issue to answer my question.
    Thanks to anyone who can help.

    Never mind.
    I copied it and renamed it and all is well.

  • Difference in views "Organization and Staffing" & "Organization and Staffin

    We are using the PPOME “Organization and Staffing” in a workflow for Role Resolution.
    The Standard Role “0000157” (Superior –chief Position- ) is to be used, which will require a restructuring of the Org Structure.
    Therefore,  I need to know,
    The difference between the two views  "Organization and Staffing" & "Organization and Staffing (workflow)",
    and if these two views are synchronized.
    And if there is difference between the two views then how to configure the view “"Organization and Staffing (workflow)" for using in the workflow.
    Regards,
    Khawaja  Bilal Sohaib.

    One works on the structure created for the HR plan variant, the other works on the structure created for the workflow plan variant. Of course, in many (probably most) systems, these two variants are identical, so there will not be any visible difference.
    <i>Message was edited by Kjetil Kilhavn:</i>
    Sorry, I didn't notice that you had already decided that the question had been answered satisfactorily. Still, even if it solved your problem, the correct answer is that all those PP*W transactions work on structure for the workflow plan variant.
    See also Re: Plan Version (you can use SM30 to add the table entry).

  • Workflow and/ or script to rename finder items using a .txt or a .csv file as a reference?

    Can someone assist me, I am looking for a workflow and/ or script that would allow me to rename finder items using a .txt or a .csv file as a reference for the new naming convention?

    THANK YOU!!!! 
    I have taken your recommendation and enabled the script menubar item.  I also tweeked the script as you recommended, I will play with both options to see which I prefer.   I thank you again for the quick turn around on this. 
    If I am to understand your comment correctly about placing the .csv file in the same folder as the files to be renamed I should modify the script as such.
    REMOVE:    
                        set csvFile to choose file with prompt "Select the CSV file." of type "public.text"
                        set workingFolder to (choose folder "Select the folder to be processed") as text
                        set fileList to (POSIX path of (files of folder workingFolder whose visible is true and name begins with "untitled"))
    REPLACE WITH:     
                        set csvList to paragraphs of (read "/path/to/csvfile.csv")
                          set fileList to (POSIX path of (files of folder "/pah/to/folder" whose visible is true andname begins with "untitled"))
    After reading this and attempting to modify it I am missing one piece of markup or the arrangement of the markup.
    Please find the modified script with options:
    -- change this to specify the correct csv delimiter
    set splitDelimiter to ","
    -- change this to specify the file name join character
    set recombineDelimiter to "_"
    -- choose the csv file
    set csvFile to choose file with prompt "Select the CSV file." of type "public.text"
    -- choose the folder
    set workingFolder to (choose folder "Select the folder to be processed") as text
    -- csv contents as list
    set csvList to paragraphs of (read csvFile)
    --set csvList to paragraphs of (read "/path/to/csvfile.csv")
    tell application "System Events"
    -- list of files in alphabetical order
         set fileList to (POSIX path of (files of folder workingFolder whose visible is true and name begins with "untitled"))
      -- set fileList to (POSIX path of (files of folder "/path/to/folder" whose visible is true and name begins with "untitled"))
         repeat with i from 1 to count of fileList
    -- get a file from the file list and note its extension
              set currentFile to file (item i of fileList)
              set fileExtension to name extension of currentFile
    -- get a line from the csv list, split it at the delimiter,  and recombine it
              set {oldTID, my text item delimiters} to {my text item delimiters, splitDelimiter}
              set newFileNamePieces to text items of (item i of csvList)
              set my text item delimiters to recombineDelimiter
              set newFileName to newFileNamePieces as text
              set my text item delimiters to oldTID
    -- write the new name back out to the file
              set name of currentFile to (newFileName & "." & fileExtension)
         end repeat
    end tell

  • Ssis - move files from one directory to another and rename destination file if present

    Hello,
    How is it possible to move files from one directory to another directory and if the file already exists in destination directory then rename it?
    Thanks

    1. Use a foreach loop with file enumerator pointing to first directory.
    Inside loop have a ssis variable of type string to get filename (@[User::FileName])
    Choose option as Fully Qualified in loop
    2. Add another variable called @[User::DestFileName], set EvaluateAsExpression true for it and set expression like this
    REPLACE(@[User::FileName],<source directory path>,<destination directory path>)
    put actual paths in above expression in your case
    and another variable called @[User::RenameFileName], set EvaluateAsExpression true for it and set expression like this
    REPLACE(@[User::FileName],".","_old.")
    3. Create a boolean variable say @[User::FileEXists]
    4. Add a Script Task inside the loop and pass @DestFileName variable in ReadOnly mode and FileExists in ReadWrite mode
    Inside Script Task write code as per below
    http://blog.dbandbi.com/2013/11/13/check-file-exists-ssis/
    5. Add File System Task choose operation as Rename File, Select IsSourcePathVariable as true and select @[user::DestFileName] variable and IsDestinationPath variable as true and select @[user::RenameFileName] variable
    6. Choose ExpressionAndConstraint option for precedeence constraint from ScriptTask to above File System Task and choose constraint as OnSuccess and expression as
    @FileExists == True
    7. Add another File System task with operation as Move File Select IsSourcePathVariable as true and select @[user::FileName] variable and IsDestinationPath variable as true and select @[user::DestFileName] variable. Join Script Task as well as
    File System Task above to this task and choose constraint as OnSuccess and Multiple Constraint option as Or (dotted line)
    Then once executed it will work as per your requirement
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Regarding ssis - move and rename files

    Hi,
    i have two txt files in c drive ,
    and i have to move two files in d drive at a time and should rename that files

    for some exmaples you can check this : http://www.rafael-salas.com/2007/03/ssis-file-system-task-move-and-rename.html
    regards
    joon

  • Move and Rename file

    I am trying to move and rename all the files with extension csv in the folder. 
    c:\folder\a.csv c:\Newfolder\a20141151011.csv  datetime append after moving
    c:\folder\b.csv c:\Newfolder\b20141151011.csv 
    I cannot use ssis it has to be done in TSQL 
    DECLARE @FILELOCATION VARCHAR(250)
    DECLARE @FINALLOCATION VARCHAR(250)
    DECLARE @FILENAME VARCHAR (250) = '*.CSV'
    DECLARE @DESTINATIONFILENAME VARCHAR (250) --= @filename + '.txt'
    SET @FILELOCATION = 'C:\folder\'
    SET @FINALLOCATION = 'C:\Newfolder\' 
    DECLARE @C VARCHAR (2000)
    SET @C = 'MOVE ' + @FILELOCATION + @FILENAME  +' ' + @FINALLOCATION + @DESTINATIONFILENAME 
    exec master.dbo.xp_cmdshell @C

    the below code works fine for moving a file. For moving all files with their respective names you could try going in for a loop and achieving the same file by file.
    DECLARE @FILELOCATION VARCHAR(250)
    DECLARE @FINALLOCATION VARCHAR(250)
    DECLARE @FILENAME VARCHAR (250) = 'multilingual_sample.TXT'
    DECLARE @DESTINATIONFILENAME VARCHAR (250) = @filename --+ '.txt'
    SET @FILELOCATION = 'D:\'
    SET @FINALLOCATION = 'D:\Newfolder\'
    DECLARE @C VARCHAR (2000)
    SET @C = 'MOVE ' + @FILELOCATION + @FILENAME +' ' + @FINALLOCATION + @DESTINATIONFILENAME
    PRINT ISNULL(@C,'---')
    exec xp_cmdshell @c
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • Automator script search document for file name, and rename file to date

    Hi all,
    I'm having a hard time with Automator... and I can't figure out how it's done!
    Searched the web for it a couple of times, spend hours with Automator already, but I guess my need is random!
    The thing is:
    I got a folder with 1066 files, all the files has random names.....
    I got a document (now it's html, but can convert it to PDF or txt or so ever....) with the coressponding random file names in the html.... some words before that there is the date the photo was taken in this format: 08/25/11
    Now I want somehow make automator search that folder each filename... match it in the document with the filename, and rename the files in the folder to the date the photo's were taken.... and that for all 1066 files.....
    anybody a great idea? Some help? I'm a real newby at Automator scrips!
    thanks

    Have you considered A Better Finder Rename 9?
    A Better Finder Rename 9: The Batch File Renamer for Mac OS X
    Otherwise, what you propose seems to be rather like carving the Pieta using a plastic butter knife. But, if you want, here's one example of a rough algorithm to start ...
    * translate the HTML to ASCII text in this format:  filename (date)
    * read one line at a time from the ASCII file
    * for each line, search the folder for the file
    * rename the file according to the (date)
    BTW, you might avoid a strict renaming according to just the date.
    Best luck with this project.
    JJW

  • Droplet to Rename Folders and Files

    I am an AS newbie and I need some help. Our accounting software creates a folder structure on our server when a job is created with a 6 digit job number. Enclosed in this folder is a set of sub-folders which are generated with a generic name: 0000_Art, 0000_Final, 0000_Fonts etc. It also places a generic rtf file named 0000_Readme. When work begins on a job we currently have to replace the "0000" with the last four digits of the job number: "140662" = "0662_Art" etc.
    I found a script to do this with some manual intervention but wanted to take this one step further by creating a droplet and making it drag and drop. This droplet works, but the problem comes in that it still wants you to choose the target folder from a dialog and I would like to just auto process the dropped folder and it's contents. Also, is there a way to tell AS to use characters 3-6 of the dropped folder's name to replace any instances of "0000" in sub-folder or document names enclosed? Is there any uneccessary code which can be stripped out?
    Here is the script as it stands now:
    on open of finderObjects
    set the source_folder to (choose folder with prompt "Folder containing items to edit:") as Unicode text
    display dialog "Search and replace in:" buttons {"File Names", "Folder Names", "Both"} default button 3
    set the search_parameter to the button returned of the result
    repeat
    display dialog "Enter text to find in the item names:" default answer "0000" buttons {"Cancel", "OK"} default button 2
    set the search_string to the text returned of the result
    if the search_string is not "" then exit repeat
    end repeat
    repeat
    display dialog "Enter replacement text:" default answer "" buttons {"Cancel", "OK"} default button 2
    set the replacement_string to the text returned of the result
    if the replacement_string contains ":" then
    beep
    display dialog "A file or folder name cannot contain a colon (:)." buttons {"Cancel", "OK"} default button 2
    else if the replacement_string contains "/" then
    beep
    display dialog "A file or folder name cannot contain a forward slash (/)." buttons {"Cancel", "OK"} default button 2
    else
    exit repeat
    end if
    end repeat
    display dialog "Replace “" & the search_string & "” with “" & the replacement_string & "” in every item name?" buttons {"Cancel", "OK"} default button 2
    tell application "Finder"
    -- Get a Finder reference to the relvant items.
    if (search_parameter is "Folder Names") then
    set item_reference to a reference to (folders of entire contents of folder source_folder whose name contains search_string)
    else if (search_parameter is "File Names") then
    set item_reference to a reference to (files of entire contents of folder source_folder whose name contains search_string)
    else
    set item_reference to a reference to (items of entire contents of folder source_folder whose name contains search_string)
    end if
    -- Get a list of aliases to the items.
    -- (Individual Finder references might fail when renaming items within renamed folders.)
    try
    set item_list to item_reference as alias list
    on error
    set item_list to item_reference as alias as list
    end try
    if item_list is not {} then
    -- If there are any relevant items, get their names.
    set current_names to name of item_reference
    -- Doctor each name...
    repeat with i from 1 to (count current_names)
    set astid to AppleScript's text item delimiters
    set AppleScript's text item delimiters to search_string
    set text_items to text items of (item i of current_names)
    set AppleScript's text item delimiters to replacement_string
    set newitemname to text_items as Unicode text
    set AppleScript's text item delimiters to astid
    -- ... and rename the associated item.
    my setitemname(item i of item_list, newitemname)
    end repeat
    end if
    end tell
    end open
    beep 2
    on setitem_name(thisitem, newitemname)
    tell application "Finder"
    --activate
    set the parent_container to (the container of this_item)
    if not (exists item newitemname of the parent_container) then
    try
    set the name of this_item to newitemname
    on error the error_message number the error_number
    if the error_number is -59 then
    set the error_message to "This name contains improper characters, such as a colon (:)."
    else --the suggested name is too long
    --set the error_message to error_message -- "The name is more than 31 characters long."
    end if
    --beep
    set newitemname to my getnew_name(errormessage, newitemname)
    if (newitemname is 0) then return 0
    my setitem_name(thisitem, newitemname)
    end try
    else --the name already exists
    --beep
    set newitemname to my getnewname("This name is already taken, please rename.", newitemname)
    if (newitemname is 0) then return 0
    my setitem_name(thisitem, newitemname)
    end if
    end tell
    end setitemname
    on getnewname(msg, default_answer)
    tell application (path to frontmost application as Unicode text)
    set {text returned:newitemname, button returned:button_pressed} to (display dialog msg default answer default_answer buttons {"Cancel", "Skip", "OK"} default button 3)
    if (button_pressed is "OK") then
    return newitemname
    else if (button_pressed is "Skip") then
    return 0
    else
    error number -128 -- only necessary on non-English systems.
    end if
    end tell
    end getnewname
    Various Mixed Macs   Mac OS X (10.4.3)  
    Various Mixed Macs   Mac OS X (10.4.3)  

    Hi lunarlandr and welcome to Apple Discussions!
    Without going through the script in detail, there's a lot that can be stripped out, and a few goodies that can be added.
    Droplets work best when iterating through lists (even one-item lists) of Finder items. As a brief example:
    on open (these_objects)
    repeat with each_object in these_objects
    --do something with each object in turn
    end repeat
    end open
    You need to remove the line beginning "choose folder" and let each_object become your source folder.
    The code below is rough and may need some amendment, but it should answer most of your questions. Test it and see.
    --begin script
    on run
    display dialog "I'm a droplet! Drop things on me!" buttons {"OK"} default button 1 with icon note
    --although you could incorporate a choose folder here
    end run
    on open (these_objects) -- a list of aliases
    repeat with each_object in these_objects
    set item_info to info for each_item
    set folder_contents to (list folder item_info)
    if kind of item_info is "Folder" and folder_contents contains "0000_Readme" then -- only process job folders
    set job_number to text 3 thru 6 of name of item_info
    process (eachobject,jobnumber)
    else --not a job folder
    display dialog "I only work with proper job folders." buttons {"OK"} with icon note giving up after 3 -- move on to next item in list
    end if
    end open
    on process (topfolder,jobnumber)
    tell application "Finder"
    set folder_contents to every item of top_folder
    repeat with each_item in folder_contents
    set generic_name to name of each_item
    if generic_name begins with "0000_" then
    set name of each_item to job_number & text 5 thru -1 of generic_name --everything from the underscore to the end
    end if
    end repeat
    end tell
    end process
    --end script
    The droplet will process multiple folders with different job numbers, without any user interaction. The name of the internal files and folders is derived from the name of the dropped folder.
    Hope it helps,
    (Although I don't see why the accounting software shouldn't do all of this for you...)
    H

  • Massive Aperture cleanup of duplicates and renaming of files...

    Hi,
    I have been wanting to clean up a massive (tens of thousands) cleanup of duplicates for quite some time, and work out a more sustainable workflow and filehandling.
    The combination of several small tools seems to give me what I want, and by using:
    1. Aperture to export masters with XMP sidecars
    2. Mr. Clean (http://www.arcobaleno2001.it/), to clean out duplicate files
    3. EXIFRenamer to rename files to createiondate_creationtime.ext
    4. DateTree (http://www.orange-carb.org/DateTree/) to place files in a hierarchical structure based on creation date
    ...leaves me only to figure out how to bring along the XMP sidecar files and have them renamed together with the image files and I would love any input on that.
    Obviously, any work done in Aperture in terms of manual sorting/grouping will be lost, but I am willing to make that sacrifice in order to avoid a manual cleanup. Anyone with a similar type of job under the belt - willing to share the experience?
    Best regards,
    Kjell Are Refsvik

    Broken Links
    It depends a bit on why things aren't where iTunes expects to find them but if they are in sensible Artist & Album folders in some common location then my FindTracks script should be able to reconnect them to iTunes. FindTracks uses some fuzzy matching routines and searches for multiple potential locations within a media folder. For more details see this thread.
    Duplicates
    Apple's official advice is here... HT2905 - How to find and remove duplicate items in your iTunes library. It is a manual process and the article fails to explain some of the potential pitfalls.
    Use Shift > View > Show Exact Duplicate Items to display duplicates as this is normally a more useful selection. You need to manually select all but one of each group to remove. Sorting the list by Date Added may make it easier to select the appropriate tracks, however this works best when performed immediately after the dupes have been created.  If you have multiple entries in iTunes connected to the same file on the hard drive then don't send to the recycle bin.
    Use my DeDuper script if you're not sure, don't want to do it by hand, or want to preserve ratings, play counts and playlist membership. See this thread for background and please take note of the warning to backup your library before deduping.
    (If you don't see the menu bar press ALT to show it temporarily or CTRL+B to keep it displayed)
    I intend at some point to improve DeDuper so that when there are multiple duplicates, where at least one is connected to a file while others are missing, it can throw away the entries to any missing files, however the current version needs all duplicates to have been repaired first.
    tt2

  • Applescript to extract subtitles, move and rename

    Hi guys. I'm trying to execute a script I've found on the web and adpated it a little bit.
    What I want to do is to extract .zip files from a folder, move the .srt files to the series/movies folder, and rename the .srt and .avi files to the same name.
    So far I was able to write the extraction and moving but after I changed some variables I got stuck with this script.
    Can someone help me?
    Below are the original e adapted scripts.
    ORIGINAL:
    property extensionList : {"mp4", "flv"}
    tell application "Finder"
        set the sourceFolder to choose folder with prompt "Select Input Folder"
        set the outputFolder to choose folder with prompt "Select Output Folder"
        set inputFiles to every file of the sourceFolder whose name extension is "rar"
        repeat with i from 1 to the count of inputFiles
            set theArchive to POSIX path of ((item i of inputFiles) as string)
            tell application "RAR Expander"
                expand theArchive to POSIX path of outputFolder
            end tell
        end repeat
        set extractedFiles to every file of the outputFolder
        repeat with i from 1 to the count of extractedFiles
            if (the name extension of the (item i of extractedFiles) is not in the extensionList) then
                do shell script "rm -rf " & quoted form of (POSIX path of ((item i of extractedFiles) as string))
            end if
        end repeat
    end tell
    ADAPTED:
    property extensionList : {"srt"}
    tell application "Finder"
              set the sourceFolder to (path to "/Users/*****/Downloads/Subtitles/")
              set the outputFolder to (path to "/Users/*****/Downloads/Series/")
              set inputFiles to every file of the sourceFolder whose name extension is "zip"
              repeat with i from 1 to the count of inputFiles
                        set theArchive to POSIX path of ((item i of inputFiles) as string)
                        tell application "The Unarchiver"
      unarchive theArchive to POSIX path of outputFolder
                                  tell application "The Unarchiver" to close
                        end tell
              end repeat
              set extractedFiles to every file of the outputFolder
              repeat with i from 1 to the count of extractedFiles
                        if (the name extension of the (item i of extractedFiles) is not in the extensionList) then
                                  do shell script "rm -rf " & quoted form of (POSIX path of ((item i of extractedFiles) as string))
                        end if
              end repeat
    end tell
    It's compiling but when I try to run it I get the error: It's not possible to transform "Users/*****/Downloads/Subtitles/" into constant.
    Thanks and sorry for my bad english.

    Ah, I didn't look farther on in the script.
    Generally it's bad practice to nest application tell blocks.  It usually works, but it's unpredictable and can produce some confusing errors.  Also, it's generally better to use System Events.app rather than the Finder (except for a couple of things the Finder does better).  SE is more efficient and less picky about file references.  so I've twiddled your script a bit:
    set dl to path to downloads folder from user domain
    tell application "System Events"
              set the sourceFolder to folder "Subtitles" of dl
              set the outputFolder to POSIX path of folder "Series" of dl
              set inputFiles to POSIX path of every file of the sourceFolder whose name extension is "zip"
    end tell
    repeat with thisArchive in inputFiles
              tell application "The Unarchiver"
                        unarchive thisArchive to outputFolder
                        close
              end tell
    end repeat

Maybe you are looking for