IPB





Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> FTP Script
MonkeyFiend
post Feb 18 2008, 10:45 AM
Post #1


Security and Projects
**********

Group: Clan Dogsbody
Posts: 4,687
Thank(s): 1098
Points: 2,440
Joined: 31-August 07
From: A Magical Place, with toys in the million, all under one roof
Member No.: 1




Someone was asking me about FTP'ing PB sceenshot files from gameserver to webserver.

I can't remember who (but I do remember they were hosted by rackage who only allow the master FTP account (which is a big security risk) script is a windows bat file (not sure what hosting you're on). Run it as a scheduled task/cron job every 24 hours etc.,

CODE
rem bf2_pbss.bat

rem set temp variables
rem only this section should be different on each server
set homedir=E:\
set bf2dir=E:\bf2ranked
set ftpuser=####@ftp.sneakymonkeys.com
set ftppass=####
set ftpserver=ftp.sneakymonkeys.com

rem Abort if no PB screenshots exist
if not exist %bf2dir%\pb\svss\*.png goto clean-up
rem rename pb screenshots adding random number
cd %bf2dir%\pb\svss
for %%i in (*.png) do ren %%i %random%_%%i
cd %homedir%

rem build ftp commands file
echo open %ftpserver%> bf2_uploader.txt
echo %ftpuser%>> bf2_uploader.txt
echo %ftppass%>> bf2_uploader.txt
echo prompt>> bf2_uploader.txt
echo type binary>> bf2_uploader.txt
echo cd /logs>> bf2_uploader.txt
rem select pb screenshots
echo mput %bf2dir%\pb\svss\*.png>> bf2_uploader.txt
echo bye>> bf2_uploader.txt

rem upload all selected files to ftp server
ftp -s:bf2_uploader.txt

rem delete all pb screenshots
del %bf2dir%\pb\svss\*.png /q

:clean-up
set homedir=
set bf2dir=
set ftpserver=
set ftpuser=
set ftppass=
del bf2_uploader.txt



cheers,

MonkeyFiend


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

Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

 



RSS Lo-Fi Version Time is now: 23rd November 2024 - 04:44 PM
Sneaky Monkeys Clan :: MonkeyFiend.com