I am making a smart folder similar to a symbolic link that whenever a folder is created or something gets saved, its uploaded to my server. the folder structure is to match exactly what is on the server. Every folder will have this script attached:
I'm having problems with the last
the script grabs the name of the directory or file and recursively calls the same applescript attached to a containing folder up until it reaches the parent folder: place_on_server. Then it calls the shell script I'm using for uploads. I'm doing this because... I need the path, and I didn't think to just echo the path itself. whatever. learning experience. Problem is I have no idea how I would differentiate between a folder or a file in applescript. Any ideas?
Code:
-- https://discussions.apple.com/thread/1485146?start=0&tstart=0
-- https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/osascript.1.html
-- https://forums.macrumors.com/threads/1089834/
on run argv
set FolderPath to current Folder
set thename to name of FolderPath
if thename = "place_on_server"
try
tell application "System Events"
do shell script "HD:users:Jason Dancks:Desktop:place_on_server:uploadSO"&argv
end tell
end try
else
set thenext to name of container of FolderPath":alertscriptrev.scpt"
try
do script thenext&argv&thename
end try
end if
end run
on adding folder items to this_folder after receiving added_items
set lastchar to
try
tell application "System Events"
if added_items --right here. I thought I would look for "/"
--as the last character to see if folder or file
do shell script "HD:users:Jason Dancks:Desktop:place_on_server:uploadSO"&"FILE"&this_folder&"/"&added_items
end tell
end try
end adding folder items to
I'm having problems with the last
the script grabs the name of the directory or file and recursively calls the same applescript attached to a containing folder up until it reaches the parent folder: place_on_server. Then it calls the shell script I'm using for uploads. I'm doing this because... I need the path, and I didn't think to just echo the path itself. whatever. learning experience. Problem is I have no idea how I would differentiate between a folder or a file in applescript. Any ideas?