Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Thread Tools Search this Thread
Old 21-04-2009
Join Date: Jan 2009
Posts: 61
Compress each file with automator


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!
Reply With Quote
Old 21-04-2009
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
Reply With Quote
Old 21-04-2009
Join Date: May 2008
Posts: 2,383
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 ...
Reply With Quote
Old 21-04-2009
Join Date: Jan 2008
Posts: 1,515
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
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 ....
Reply With Quote

  TechArena Community > Software > Software Development
Tags: , ,

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

All times are GMT +5.5. The time now is 01:01 AM.