Results 1 to 4 of 4

Thread: Compress each file with automator

  1. #1
    Join Date
    Jan 2009
    Posts
    61

    Compress each file with automator

    Hello,

    I try to use Automator for the first time . I thought to get a script easily enough to compress each file in a folder (91 files in 91 compressed archives). A prior, not something complicated, the name does not change (only the extension obviously ). But now,with Automator, i am unable to understand Someone would kindly explain the process?

    Thank you very much!

  2. #2
    Join Date
    Aug 2007
    Posts
    1,098

    Re: Compress each file with automator

    you need to take look on forum basic is already present ,To begin to understand try this Apple Mac os Automator:Automate your tasks

  3. #3
    Join Date
    May 2008
    Posts
    2,389

    Re: Compress each file with automator

    you can use Applescript to do that, and it would be easy to make a script that did this 3 times in 2 movements. As against, if you know there nothing you get time to use Automator effectively.

    There is a script done everything if I remember correctly in the Developer / Examples / AppleScript Studio, and it should be called Archive Maker.Just compile it with Xcode and see there ...

  4. #4
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Compress each file with automator

    I found a track easier for me, a detail does not yet, since this script all zip files and folder ... I detail it ...

    automator level:
    get the selected items
    get the contents of files

    I tried to filter elements according to the extension but the following does not blow ...

    then execute a script applescript Next

    on run (input, parameters)
    - Create a PKZip archive of the selected Finder item (s)
    - If no destination folder is specified, the archive will be placed in the same location
    - Input: a list of Finder items to archive
    - Output: a list of Finder items archived

    set output to ()
    SkippedItems set to () - this will be a list of skipped items
    DestinationFolder set to missing value - a Finder path to a destination folder if different

    repeat with SomeItem in the input - step through each item in the input
    try
    SomeItem set to SomeItem as text
    if the last character of SomeItem is in {":", "/") then set SomeItem to text 1 through -2 of SomeItem
    ArchiveSource set to POSIX path of SomeItem
    if DestinationFolder is missing value then - save the archive to the same location
    set to ArchiveSource & ArchiveName. "zip"
    else - save the archive to the specified folder
    TheName set to name of (info for SomeItem as alias)
    ArchiveName set to (POSIX path of DestinationFolder) & & TheName. "zip"
    end if
    do shell script "ditto-ck" & (quoted form of ArchiveSource) & space & (quoted form of ArchiveName)
    set the end of the output to (POSIX file ArchiveName) as alias - success
    on error errorMessage number ErrorNumber
    log errorMessage
    set the end of SkippedItems to SomeItem
    end try
    end repeat

    if SkippedItems is not () then - handle skipped items
    TheCount set to (count SkippedItems) as text
    display alert "Error with Archive action" message TheCount & "items (s) were skipped - workflow will continue"
    (*
    choose from list SkippedItems with title "Error with Archive action" with prompt "The following items were skipped:" with empty selection allowed
    if result is false then error number -128 - user canceled
    *)
    end if

    return the output - pass the result (s) to the next action
    end run
    either we reach a filter via the search for automator folder, or adding an instruction applescript to filter files and to limit the extension adds a check for only one type of zip file or two ....

Similar Threads

  1. need assistance to compress an excel 2010 file
    By Vento in forum Windows Software
    Replies: 5
    Last Post: 28-03-2012, 03:25 PM
  2. How to use Apple Automator
    By Tech-Kida in forum Windows Software
    Replies: 8
    Last Post: 25-09-2010, 08:53 PM
  3. How to compress .mdf file in SQL2000
    By Kaufman in forum Software Development
    Replies: 4
    Last Post: 14-02-2010, 03:29 AM
  4. Unable to compress a file
    By EULALIA in forum Windows Software
    Replies: 3
    Last Post: 13-05-2009, 11:56 PM
  5. How to Compress/ decompress a file in linux
    By Becse in forum Operating Systems
    Replies: 2
    Last Post: 09-01-2009, 03:07 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,155,348.10296 seconds with 16 queries