Any help on this would be greatly appreciated. I’m a cUrl newbie, I want to monitor an FTP folder of all subdirectories. I found a script in the Code Exchange that I tought would do this, but it has not worked. I THINK because the cUrl -list-only command does not work for subdirectories.
I am able to get the list with Terminal. User error, haha.
Still working on the script though. Really I just need something that will compare two text documents and give me the items that are different.
EDIT:
Made some good progress, not done though. I still need to set up the emailer and work out a few bugs.
--http://macscripter.net/viewtopic.php?id=36602
on run
--change these 4 parameters to your info
set myUser to "user"
set myPass to "pass"
set ftpURLClean to "[url=http://www.example.com]www.example.com[/url]"
set ftpPath to "/stuff/"
set ftpURL to "ftp://" & myUser & ":" & myPass & "@" & ftpURLClean & ftpPath
--check if the old txt log exists
tell application "Finder"
set filePath to POSIX file "/ftp_old.txt"
if not (exists filePath) then
try
set fileRef to open for access filePath with write permission
write "" to fileRef
close access fileRef
on error
try
close access file filePath
end try
end try
end if
end tell
--send the file to your root drive
try
set ftpCommand to "curl -l " & quoted form of ftpURL & " -o ftp_new.txt"
do shell script ftpCommand
on error msg
display dialog msg
return
end try
--compare old and new
set theOutput to paragraphs of (do shell script "sort /ftp_old.txt /ftp_new.txt | uniq -u")
if (count of theOutput) = 0 then
display dialog "There are no new files." giving up after 3
return
else
display dialog theOutput
return
end if
--make ftp_new.txt into ftp_old.txt
try
do shell script "rm /ftp_old.txt; mv /ftp_new.txt /ftp_old.txt"
on error msg
display dialog msg
end try
end run
--on idle
-- return 900 --15 minutes
--end idle