Need help with script/Automator

Discussion in 'macOS' started by cmcconkey, Aug 22, 2007.

  1. cmcconkey macrumors 6502

    Joined:
    Nov 22, 2005
    Location:
    Rocky Face, GA
    #1
    I am trying to create a script that will hunt through a hard drive partition and will move files, not folders, that are a certain date or older to a holding folder that I can then delete manually. Can this be done without purchasing anymore software?

    Thanks in advance
    Christopher
     
  2. GimmeSlack12 macrumors 603

    GimmeSlack12

    Joined:
    Apr 29, 2005
    Location:
    San Francisco
    #2
    Automator is your tool of choice for this. But I have to ask, you really want to go through your whole Hard Drive? What about specific folders? The idea I'm thinking is to make a Automator Finder-script where you can right click a folder and have the search go through the files in there and move those to the Delete Folder.

    Otherwise you can risk having important files get scooped up in your search to delete, and that would be no fun. I'll get the details to you in a bit regarding the way to setup your Automator workflow.

    EDIT: Here we go! I wasn't able to get the Finder plug-in option working, but I only worked on it for a sec.
    Library : Action
    Finder : Find Finder Items>Date Created Before (put in the beginning folder to use here)
    Finder : Filter Finder Items> File Type> Is Not> AppleScript Bundle (this is used to avoid grabbing folders and assuming you don't have any Applescript Bundles)
    Finder : Move Finder Items (Make your Delete manually folder)

    That should do it. Now save that as an Application and you will be set to go.
     
  3. cmcconkey thread starter macrumors 6502

    Joined:
    Nov 22, 2005
    Location:
    Rocky Face, GA
    #3
    This is exactly what I want. I work for a commercial printing company and we receive 10-12 optical disks a week. This tends to load up a drive pretty quickly, and I have asked the layout operators to clean up after themselves but it never seems to happen.

    The drive that I am wanting to use this on is a temporary storage area that when a customer sends in a disk and wants some art done, we grab the files we need and never need to use the rest. I currently have about 100 Gigs of files within about 84 customer folders with on average 10-12 folders inside them. It is a nightmare that I have to get worked out before it takes up too much room.

    Christopher
     
  4. GimmeSlack12 macrumors 603

    GimmeSlack12

    Joined:
    Apr 29, 2005
    Location:
    San Francisco
    #4
    With that many files I would actually like to watch this Automator in action. Its a great program and really worth spending some time screwing around with. I used to use workflows similar to this one to clean out my downloads folder and/or sort out pictures and PDF's to other folders.

    Nowadays I use automator on a nearly daily basis from the mundane (capitalizing filenames) to advanced network copies (send bittorrent file to download computer and activate). www.macscripter.net is a great place for more info.

    EDIT: Oh, and if you are to use this program progressively, then you might want to click the small triangle in the "Find Finder Items" and hit the checkbox in there (see action when run or something like that). This will give you the chance to change the date anytime you run this Workflow.
     
  5. cmcconkey thread starter macrumors 6502

    Joined:
    Nov 22, 2005
    Location:
    Rocky Face, GA
    #5
    I just pulled a 12.3 gb folder from the drive and ran the automator script that I put together. Well it worked, but seemed to miss some things. I will do a little more digging and see what I can come up with. I also selected a date about 10 days ago which would get rid of about 98% of what is in this folder, well my Automator crashed out. I would hate to see what would happen on a 100 gb folder set. I may have to look at some other way of accomplishing this, unless you have any more ideas.


    THanks
    Christopher
     
  6. GimmeSlack12 macrumors 603

    GimmeSlack12

    Joined:
    Apr 29, 2005
    Location:
    San Francisco
    #6
    I think I can come up with a way to get all files and avoid folders. Or does that not matter? If folders don't matter then take out the Filter items in the workflow.

    If it crashes out then perhaps I'll go back to the drawing board. I'm not at my Mac at the moment and only came up with that workflow using VNC on my Mac back home. Not the speediest of computing. I'll take a look tonight.

    EDIT: I got another one. Use Finder : Get Folder Contents>Repeat for each Sub Folder, instead of the Filter action. That will get it working. Not sure if it will crash out on big folder sizes or not.
     
  7. GimmeSlack12 macrumors 603

    GimmeSlack12

    Joined:
    Apr 29, 2005
    Location:
    San Francisco
  8. cmcconkey thread starter macrumors 6502

    Joined:
    Nov 22, 2005
    Location:
    Rocky Face, GA
    #8
    Thanks for giving me some ideas. I haven't had much of a chance to commit much time this afternoon thanks to babysitting Retrospect (backing up my xServe). I am going to do some brain storming tonight on my PowerBook, but no chance at much testing unless I hit my externals. If you come up with a script just let me know what your steps were or send it to me. I will be online most of the night tonight, so I should be able to get back to you pretty quickly.

    Thanks
    Christopher
     
  9. GimmeSlack12 macrumors 603

    GimmeSlack12

    Joined:
    Apr 29, 2005
    Location:
    San Francisco
  10. cmcconkey thread starter macrumors 6502

    Joined:
    Nov 22, 2005
    Location:
    Rocky Face, GA
    #10
    I have finally gotten a chance to get back to this, sorry that it has taken so long. I have the action built and I am pulling a test set of files from my xServe & will be testing it within the hour. Hopefully this will work out.


    Thanks
    Christopher
     

Share This Page