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!
Re: Compress each file with automator
you need to take look on forum basic is already present ,To begin to understand try this http://forums.techarena.in/guides-tutorials/1165278.htm
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 ...
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
Quote:
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 ....