Here are some useful functions for the FTP action plugin by IndigoRose.
  • table: FTPEx.GetFiles(sDir);
  • boolean: FTPEx.FileExists(sFile);
  • nil: FTPEx.CreateDummyFile(sFile, sExtension, sInitialContent);
  • nil: FTPEx.Append(sFile, sContent, bNewLine)

(Italic arguments are not required to be passed to the function.)

Code:
--[[

	Name:		FTPEx

	Author:		ShadowUK

	Version:	1.0

	Description:	Some more functions for the
			FTP action plugin.

--]]

FTPEx = {}

function FTPEx.GetFiles(sDir)
	local tReturn = {};
	
	if (sDir) then
		FTP.ChangeDir(sDir);
	end

	for i, v in FTP.ListFiles() do
		if (type(v) == "table" and v.Name) then
			tReturn[Table.Count(tReturn) + 1] = v.Name;
		end
	end
	
	return tReturn;
end

function FTPEx.FileExists(sFile)
	for i, v in FTP.ListFiles() do
		if (type(v) == "table" and v.Name and v.Name == sFile) then
			return true;
		end
	end
	
	return false;
end

function FTPEx.CreateDummyFile(sFile, sExtension, sInitialContent)
	if not (sInitialContent) then
		sInitialContent = "";
	end
	
	if not (sFile) then
		error("FTPEx: No file specified.");
	end
	
	if not (sExtension) then
		sExtension = "txt";
	end
	
	TextFile.WriteFromString(_TempFolder.."\\"..sFile.."."..sExtension, sInitialContent, false);
	
	if (FTP.IsConnected()) then
		FTP.Upload(_TempFolder.."\\"..sFile.."."..sExtension, sFile.."."..sExtension, nil);
	end
	
	File.Delete(_TempFolder.."\\"..sFile.."."..sExtension, false, true, true, nil);
end

function FTPEx.Append(sFile, sContent, bNewLine)
	if not (bNewLine) then
		bNewLine = true;
	end
	
	local AsRand = Math.Random(9999999999999999);
	
	if (FTP.IsConnected()) then
		FTP.Download(sFile, _TempFolder.."\\"..AsRand..".tmp", nil);
		
		if (bNewLine == true) then
			TextFile.WriteFromString(_TempFolder.."\\"..AsRand..".tmp", "\r\n"..sContent, true);
		elseif (bNewLine == false) then
			TextFile.WriteFromString(_TempFolder.."\\"..AsRand..".tmp", sContent, true);
		end
		
		FTP.Upload(_TempFolder.."\\"..AsRand..".tmp", sFile, nil);
		
		File.Delete(_TempFolder.."\\"..AsRand..".tmp", false, false, false, nil);
	else
		error("FTPEx: Failed to execute, Socket not connected.");
	end
end
If you like my plugins, contributions or software. Please consider a donation using PayPal, This is not required, But I'd love some support and appreciation for my coding, As it's one of the things I can't do too often with all the exams going on at school. As coding action plugins is the kind of thing I start and never finish because no-one is interested in it.