Applescript Problem - Items in folder

Status
Not open for further replies.

The-Chihuahua

Solid State Member
Messages
19
I have made a script that takes all of the files from one folder (wich is automatically gernerated)and moves them to a dated folder in another directory, then it dumps the automatically generated folder. The script works fine except that if there is nothing in the folder it still created all of the other directories. I would like it if the dated folders were not made if nothings going in them. Anybody know how to get the script to check a folder for items before running? here is the script.

set theMonth to (do shell script "date +%m") as text
set theDay to (do shell script "date +%d") as text
set theYear to (do shell script "date +%y") as text
set FolderName to (theMonth & "." & theDay & "." & theYear)
tell application "Finder"
(* this is going to have to be only if there are items in the folder GT4 *)
make new folder at folder " • GT4" of disk "JUMPDRIVE" with properties {name:"GT4 Image Folder - TO BE RENAMED"}
set name of folder "GT4 Image Folder - TO BE RENAMED" of folder " • GT4" of disk "JUMPDRIVE" to (FolderName)
try
move files of folder "GT4" of disk "JUMPDRIVE" to folder FolderName of folder " • GT4" of disk "JUMPDRIVE"
on error
display dialog "Error moving files from the Gran Turismo 4 Image Folder!" buttons {"Damn!"} default button 1
end try
set name of folder "GT4" of disk "JUMPDRIVE" to (FolderName)
move folder FolderName of disk "JUMPDRIVE" to trash
end tell
 
Status
Not open for further replies.
Top