• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Check folder if empty
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Check folder if empty


  • Subject: Check folder if empty
  • From: Peter Mathiessen <email@hidden>
  • Date: Fri, 22 Oct 2004 20:22:09 +0200

Hi all,

I´m trying to make a script that will auto distill postscriptfiles in the
distiller. For that I need a script that checks the "in" folder and the
"out" folder in Acrobat Distiller watched folders.

I want to place a numbers of postscriptfiles in the "in" folder and let the
distiller generate PDF-files. When the task is complete every file will be
moved by the script to differrent folders.

I need some code to make certain that the "in" folder is empty and the
distiller is done with the task. I have tried many different solutions but
no one seems to work correctly.

How do I make the code that count the files in the "in" folder, if some
files is still there it will recount until the folder is empty and only if
the folder is empty it will continue the script.

This some part of the script with my, not so good, solution:

if the_Count is not equal to 0 then
repeat until the_Count = 0
set the_Count to the count of every item of searchFolder
end repeat
end if

-----------------------------------------------------------------------

The whole script:

copy "Macintosh HD:Script_folder:Distilleri:" as text to the_vol

set the_Count to 0
set searchFolder to (the_vol & "Tryck:In:")
set myList to list folder searchFolder without invisibles
repeat with myFilename in every item of myList
set countfile to alias (searchFolder & myFilename)
set the_Count to the_Count + 1
end repeat

if the_Count = 0 then
set searchFolder to alias (the_vol & "Tryck:Out")
set destinationfolder to alias (the_vol & "Klara PDF filer")
set destination_ps_folder to alias (the_vol & "temp_postscript")
set myListfolder to list folder searchFolder without invisibles
repeat with myFilename in every item in myListfolder
set myFile to alias (the_vol & "Tryck:Out:" & myFilename)
tell application "Finder"
if name of myFile ends with "pdf" then
try
set name of myFile to ("Tryck_" & myFilename)
move myFile to destinationfolder with replacing
end try
end if
if name of myFile ends with "log" then
try
move myFile to destinationfolder with replacing
end try
end if
if name of myFile ends with "ps" then
try
move myFile to destination_ps_folder with replacing
end try
end if
end tell
end repeat
end if

if the_Count is not equal to 0 then
repeat until the_Count = 0
set the_Count to the count of every item of searchFolder
end repeat
end if

-----------------------------------------------------------------------


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Check folder if empty
      • From: Simon Forster <email@hidden>
  • Prev by Date: Re: Legacy conversion of Quark 4 to InDesign 2 files question
  • Next by Date: Re: Legacy conversion of Quark 4 to InDesign 2 files question
  • Previous by thread: filemaker..
  • Next by thread: Re: Check folder if empty
  • Index(es):
    • Date
    • Thread