File Sorter, all working need it to anything left behind"PLEASE"

I have this script, and it sorts the files to move into the other folders of the desktop, I now need to add a wildcard that if it doesn't fit the files with the prefixes then move them to folder that begins with "Mik
Is this something that can be easy to do?
Many Thanks
Matt
# the file matrix is a record of {destination folder name, {list of file prefixes to move}}
set fileMatrix to {¬
          {folderName:"2_do_BHS", prefixes:{"BH70", "SM70", "AL70", "BH11"}}, ¬
          {folderName:"2_do_Bu", prefixes:{"BU40", "BU11"}}, ¬
          {folderName:"2_do_Ca", prefixes:{"CW"}}, ¬
          {folderName:"2_do_Da", prefixes:{"ES20", "AM20"}}, ¬
          {folderName:"2_do_Di", prefixes:{"DV25", "DV11"}}, ¬
          {folderName:"2_do_Do", prefixes:{"DJ30", "RA30", "DJ11"}}, ¬
          {folderName:"2_do_In", prefixes:{"GT55", "CC55"}}, ¬
          {folderName:"2_do_Fr", prefixes:{"FR10", "FR11"}}, ¬
          {folderName:"2_do_No", prefixes:{"TM17", "NN_"}}, ¬
          {folderName:"2_do_Ma", prefixes:{"MA65", "MF65", "FI65", "MC65", "MH65", "MB65"}}, ¬
          {folderName:"2_do_Pr", prefixes:{"PR_"}}, ¬
          {folderName:"2_do_To", prefixes:{"TM15", "TM11"}}, ¬
          {folderName:"2_do_Wa", prefixes:{"WA35", "WA11"}}, ¬
          {folderName:"2_do_Se", prefixes:{"SE_"}}}
tell application "Finder"
          set theHotFolder to folder "StudioA:Users:StudioA:Pictures:HotFolder2Do"
          repeat with matrixItem in fileMatrix -- look for folder
                    set destinationFolder to (folders of desktop whose name starts with folderName of matrixItem)
                    if destinationFolder is not {} then -- found one
                              set destinationFolder to first item of destinationFolder -- only one destination
                              repeat with aPrefix in prefixes of matrixItem -- look for files
                                        set theFiles to (files of theHotFolder whose name starts with aPrefix) as alias list
                                        if theFiles is not {} then repeat with aFile in theFiles -- move files
                                                  try
  move aFile to destinationFolder
                                                  on error errmess number errnum -- oops (should probably check for a specific error number)
                                                            log "Error " & errnum & " moving file: " & errmess
                                                            set newName to my getUniqueName(aFile, destinationFolder)
                                                            set name of aFile to "this is a unique name" -- or whatever
  move aFile to destinationFolder
                                                            set name of aFile to newName
                                                  end try
                                        end repeat
                              end repeat
                    end if
          end repeat
end tell
to getUniqueName(someFile, someFolder)
     check if someFile exists in someFolder, creating a new unique file name (if needed) by adding a suffix
          parameters -          someFile [mixed]: a source file path
                              someFolder [mixed]: a folder to check
          returns [list]:          a unique file name and extension
          set {counter, suffixes, divider} to {0, "abcdefghijklmnopqrstuvwxyz", "_"}
          set someFile to someFile as text -- System Events will use both Finder and POSIX text
          tell application "System Events" to tell disk item someFile to set {theName, theExtension} to {name, name extension}
          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 "System Events" to tell (get name of files of folder (someFolder as text))
                    repeat while it 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
          end tell
          return newName
end getUniqueName

add the item {folderName:"Mik", prefixes:{""}} to the end of fileMatrix variable.  After it's done processing all the other elements it will look for files that are prefixed with an empty string (i.e. every file) and move those.

Similar Messages

  • I can't open a file i was working on yesterday in Photoshop CS3. Please help!

    It keeps telling me :  'Could not complete your request because the file is not compatible with this version of Photoshop'.  I can't view my file at all and it's very important. Help!!

    Could you have mis-named the file and it is actually some other file format than the suffix indicates?
    Otherwise the file may be damaged and your hopes of salvaging it depend on your back-ups or recovery software …
    http://forums.adobe.com/message/4145463#4145463

  • Photoshop CC crashed whilst saving & file is now 0kb file size, all work has gone

    My first day using CC and I have lost a days work...
    Whilst saving my latest batch of changes Photoshop crashed. OK I thought, over the years this has happend frequently.
    When I re-opened the file, I was presented with a new document setup screen... No artwork, layers, anything!
    I checked the file in question, 0kb.
    I have read that Photoshop saves a copy every 10 mins but I can't find/don't know how to access this file.
    Can anyone help I'm on a WIN8 machine

    It's not a file, it's just temp data and if the actual file structure is invalid for whatever reason, it won't do anything. Simply write off the lost file and by all means read this to avoid such issues in the future:
    Work File Safety
    Mylenium

  • File Sorter App refining needed...

    Hello,
    I was hoping somebody could help me refine a script.
    It is for sorting and organising a card out of DSLR in to files. I would like the same workflow but if the empty folders could be deleted at the end of the script, or even better it scans for file extensions and makes only the appropriate files.
    on open dd
              repeat with d in dd
      do shell script "d=" & d's POSIX path's quoted form & "
    cd \"$d\" || exit
    mkdir -p {MOV,JPG,NEF,CR2}
    find . -type f -depth 1 -iname '*.mov' -print0 | xargs -0 -J % mv % MOV
    find . -type f -depth 1 -iname '*.cr2' -print0 | xargs -0 -J % mv % CR2
    find . -type f -depth 1 -iname '*.jpg' -print0 | xargs -0 -J % mv % JPG
    find . -type f -depth 1 -iname '*.nef' -print0 | xargs -0 -J % mv % NEF
              end repeat
    end open
    Any help would be greatly appreciated.
    Dan

    add the item {folderName:"Mik", prefixes:{""}} to the end of fileMatrix variable.  After it's done processing all the other elements it will look for files that are prefixed with an empty string (i.e. every file) and move those.

  • My hp pavilion g4-2024tx's keyboard didn't work ,i cant type anything...please help

    i use win7 64bit

    Hey Tung, If your connect an external keyboard are you able to type? I would first give it a good cleaning to make sure there is nothing interfering with it. A can of compressed air usually works wonders or a air compressor if you have one handy.  If this does not work try a hard reset:  Disconnect all external devices firstRemove AC powerRemove the batteryPress and hold power button for at least 20 seconds Reinstall your batteryPlug in the PowerTurn on the computerLet me know if this helps! Sean

  • File Not Found exception.Am i missing anything?

    I have created a file called CI.xml in an eclipse folder which exists
    I am getting the message: The system cannot find the file
    my code is
    private static final String XML_TEMPLATE_FOLDER ="xml/template"
    String fileFolder = getTemplateFolder();
    File file = new File(fileFolder+"CI.xml");
    private String getTemplateFolder(){
    return XML_TEMPLATE_FOLDER;
    }If I save this file on c:\ and pass it to the file api,it works.
    am i overlooking anything?
    please guide

    masijade. wrote:
    phdk wrote:
    try: xml\\template
    or use File.separatorNo need. In the File constructors "/" is always valid, regardless of the OS. (Now Runtime.exec() is another story, but that's not what we're talking about here.)I've noticed that "/" works on Windoze, but I can't find the documentation. The closest is this, in the [File API:|http://java.sun.com/javase/6/docs/api/java/io/File.html]
    <quote>
    The conversion of a pathname string to or from an abstract pathname is inherently system-dependent. When an abstract pathname is converted into a pathname string, each name is separated from the next by a single copy of the default separator character. The default name-separator character is defined by the system property file.separator, and is made available in the public static fields separator and separatorChar of this class. When a pathname string is converted into an abstract pathname, the names within it may be separated by the default name-separator character or by any other name-separator character that is supported by the underlying system. [Ed.: hmmm]
    </quote>
    So I don't know if I can take _"/" is always valid_ as vaild, unless there's better documentation for it.

  • Just upgraded to Office 365. Reinstalled my Acrobat 7.0 standard. All I need to do is convert office files to pdf but it wont work. Any suggestions?

    Just upgraded to Office 365. Reinstalled my Acrobat 7.0 standard. All I need to do is convert office files to pdf but it wont work. Any suggestions?

    Hi,
    Acrobat 7 is not tested with Office 365. However your PDF Printer is working fine then you can print your office files to it.
    Regards,
    Anoop

  • I had all of my video files that I work on in iMovie saved to an external hard drive exclusively to save space on my Macbook.  I had just finalized a project, went to work on another one and files couldn't be found, were not deleted how do I find them?

    I had all of my video files that I work on in iMovie saved to an external hard drive exclusively to save space on my Macbook.  The other day I had just finalized a project and went to work on another one and when I opened the project I could see what should have been there, but scrolling over the entire clip I would only see black and that the file was missing.  I did not drag anything on the hard drive to the trash or move anything.  How can I get those files?  These are videos of my kids and I am devastated and willing to try anything!

    Control click does not work - no option to find files.  I have no idea what to do.  When I look at the usage of the external drive the space is being used, but I cannot find the files.  I am going to try MacKeeper's Undelete and see if I can make any progress with it. 

  • When looking at my "About This Mac" it says that I have 60gb of space left on my hard drive, but when I go into finder to find all of these files there is not 300gb worth in anything I search, even searching, "All files on the Mac". Help!?

    When looking at my "About This Mac" it says that I have 60gb of space left on my hard drive, but when I go into finder to find all of these files there is not 300gb worth in anything I search, even searching, "All files on the Mac". Help!?
    It says I have over 150 gigs of video on my hard drive. But I have gone through and deleted almost all of what shows up, still it says there is roughly the same amount on the hard drive. Where are these files? I want to delete them so I can have my hard drive clear.
    Thanks for your help guys!

    Quote from the article.
    Time Machine in OS X Lion includes a new feature called "local snapshots" that keeps copies of files you create, modify or delete on your internal disk. Local snapshots compliment regular Time Machine backups (that are stored on your external disk or Time Capsule) giving you a "safety net" for times when you might be away from your external backup disk or Time Capsule and accidentally delete a file.
    So what makes a notebook any different then a desktop, other then with a desktop you might have your tm backup drive connected all the time.
    The object here is to not indiscriminately delete files you need or want to keep. I personally have never deleted a file I wanted to keep.
    In essence a backup is for catastrophic failure of your system. So it can be restored once that failure has been fixed. Not because you go in willy nilly and start deleting files.

  • How can I sort all files and folders by size?

    Due to lack of space I need to find the biggest files and folders on my Mac OSX Mountain Lion, but "Size" is not in the Find options.
    And I don't know the wildcard to sort all files and folders by size in Easyfind.
    Thanks
    Sarah

    There are applications out there which are designed to show you files and the space they use.  Some of these applications and some strategies for making more room on your disk are given below.
    Freeing Up Hard Disk Space
    Freeing space on your Mac OS X startup disk
    Clearing Disk Space on Your Mac
    Seven ways to free up drive space

  • I'm trying to watch a movie from my iPad on my tv with Hdmi  cable.  Do I need to do anything to the tv to make this work?

    I'm trying to watch a movie from my iPad on my tv with Hdmi  cable.  Do I need to do anything to the tv to make this work?

    Not really. Using the correct Digital Av adapter and connecting the iPad to the Tv through one of its HDMI ports is all it takes. Of course making sure the correct input is selected in the Video source selection on the TV.

  • Recently bought new printer. All works fine with one OSX user. However, cannot print anything on other OSX user, including cannot print Adobe PDFs or to new printer. Puzzling!

    computer = Mac PowerPC G5
    OS = 10.4.11
    Adobe Acrobat 7
    HP laserjet M1212nf
    I recently bought a new HP printer. I was on an admin user when I installed it. All works fine with this admin account/user. I can print to the HP, print to Adobe PDFs.
    However, when I then go over to another user account, I cannot print *anything*. I cannot print to Adobe PDF, cannot print to the new HP. If I try to print an excel file, it says "cannot communicate with the printer" along with some useless suggestions. If I try to print a page on FireFox, nothing happens. That is, sure I get the usual dialog box, click the appropriate choice of printer, click the number of copies, then click the OK button ... and nothing happens. No pdf process is started. Nothing is sent to the HP printer.
    The fact that both printer options are not working suggests it is some kind of OS problem, not specific to either printer "device".
    Any assistance is appreciated! Thanks!

    Hi BDAqua,
    Thanks for the suggestion. I'm a bit leery of trying that. I would think that if the driver was not installed, then none of my users could use the printer. However, both admin users can use the new printer. The list of available printers is:
    Adobe PDF 7.0
    New HP Printer
    I also used to have Old HP Printer, which I  removed. Before, Users A, B and C could use both the Adobe PDF and the Old HP printers. Then, after I added the New HP Printer, it showed up in the list of printers for all three users. However, after I added the new printer, only the two admin accounts, users A and C, can actually print anything. Both users A and C can use the Adobe PDF printer AND the New HP Printer. But I get error messages with user B, for both the Adobe PDF printer and the New HP Printer.

  • TS1702 i have a ipod touch 2g and after a restore none of my apps will restore because it says that i need a newer version of the ipod software to run them they all work fine till i did the restore . is there any way to get them back ?

    i have a ipod touch 2g and after a restore none of my apps will restore because it says that i need a newer version of the ipod software to run them they all work fine till i did the restore . is there any way to get them back ?

    Your only way is if you have the version that was compatible on your computer such as in the recycle bin/trash or in a computer file backup. In that case delete the current version that is in your iTunes App library and replace it with the older version. Then sync.
    Also see:
    Recover Older Versions of iPhone Apps After Updating — Apple News, Tips and Reviews

  • I want to take my Mac to the US (from Australia) with me, do I need to do anything special and will it work over there? Thanks

    I want to take my Mac desktop to the US, from Australia. Do I need to do anything special to be able to do this? Will it work?
    thanks

    It will work fine - all you need is a travel adaptor to convert the power connector. You don't need a transformer or anything like that.
    Matt

  • I have to run Windows for work, which is best Parallels, Fusion, or Boot Camp? I won't need to share anything with the Mac Side.

    I have to run Windows for work, yuk! Which is best Parallels, Fusion, or Boot Camp? I will not need to share anything with my Mac side as I will just be running one program to chat on the web and send Emails.

    Parallels, Fusion and VirtualBox are all virtualization applications, they 'virtualize' (create) a Windows environment on your Macs OSX operating system.
    Boot Camp makes a compatible partition on your hard drive so you may install windows on it directly.

Maybe you are looking for

  • Saving a pdf document to my iPod Touch Gen 1

    I have a 16gb Generation 1 (Dec 2007) iPod Touch running system iOS 3.1.3 and I love it!  I shall be taking a trip and do NOT want to carry my MBP this time (vacation!) - but do want my iPod Touch with me. I'd like to have a large (28 mb, 262 page) G

  • SQL Server 2008 XML Datatype variable size limit

    Can you please let me know the size limit for XML Data type variable in SQL Server 2008? I have read some where that the XML data type holds up to 2GB size. But, its not the case. We have defined a variable with XML data type and assigning the value

  • Reg:ESS Apprisal document iview in career and job

    hi all when i am working with Appraisal document i view which is designed in wdabap application,this is a standard application.the problem here is previously i got an portal run time error,but i resolved this error by changing the system name in prop

  • Problem using List of Lists in loop

    I'm working on a test program that will pull in two text files and return a list of the words that are common among in each. I'm running into a logistical problem when trying to add elements of a list to a list of lists, and then clear the primary li

  • Application launched from Windows using Unix Adobe Document Server  Issue

    Hello,<br /><br />Sample application is written to merge two or more pdf files using Adobe Document Server.The sample application is using Webservice and laucnhed from Winodows and the AdobeDocument Server is in Unix.<br />I am getting following erro