ok

Mini Shell

Direktori : /proc/thread-self/root/proc/thread-self/root/usr/lib64/python2.7/Tools/scripts/
Upload File :
Current File : //proc/thread-self/root/proc/thread-self/root/usr/lib64/python2.7/Tools/scripts/ftpmirror.pyo

�
iцdc@s�dZddlZddlZddlZddlZddlZddlZddlmZd�Zda	da
dadada
ddd	gZd
�Zd�Zd�Zd
dd��YZd�Zd�Zd�Zedkr�e�ndS(s�Mirror a remote ftp subtree into a local directory tree.

usage: ftpmirror [-v] [-q] [-i] [-m] [-n] [-r] [-s pat]
                 [-l username [-p passwd [-a account]]]
                 hostname[:port] [remotedir [localdir]]
-v: verbose
-q: quiet
-i: interactive mode
-m: macintosh server (NCSA telnet 2.4) (implies -n -s '*.o')
-n: don't log in
-r: remove local files/directories no longer pertinent
-l username [-p passwd [-a account]]: login info (default .netrc or anonymous)
-s pat: skip files matching pattern
hostname: remote host w/ optional port separated by ':'
remotedir: remote directory (default initial)
localdir: local directory (default current)
i����N(tfnmatchcGs8tjt_x|D]}|GHqWtGHtjd�dS(Ni(tsyststderrtstdoutt__doc__texit(targstmsg((s//usr/lib64/python2.7/Tools/scripts/ftpmirror.pytusages

	iit.s..s.mirrorinfocCs�y#tjtjdd�\}}Wn tjk
rE}t|�nXd}d}d}|sktd�n|d}d}d|kr�|jdd�\}}t|�}ny7tj�j|�}|dk	r�|\}}}nWntj
tfk
rnXx|D]�\}	}
|	dkr*|
}n|	dkr?|
}n|	d	krT|
}n|	d
krmtdan|	dkr�dan|	dkr�da
n|	d
kr�dadatjd�n|	dkr�dan|	dkr�dan|	dkr	tj|
�q	q	Wd}d}|drZ|d}|drZ|d}|drWtd�qWqZntj�}
tr�d||r�d|p�dfGHn|
j||�ts�tr�d|p�dGHn|
j|||�ntr�dGHn|
j�}tdkr
dGt|�GHn|r|tdkr.dt|�GHn|
j|�tdkrOdGHn|
j�}tdkr|dGt|�GHq|nt|
|�dS(Nisa:bil:mnp:qrs:vtshostname missingit:s-ls-ps-as-vs-qs-is-ms*.os-ns-rs-siistoo many argumentssConnecting to '%s%s'...s:%dsLogging in as %r...t	anonymoussOK.sPWD =scwd(%s)(tgetoptRtargvterrorRtsplittinttnetrctauthenticatorstNonetNetrcParseErrortIOErrortverbosetinteractivetmactnologintskippatstappendtrmoktftplibtFTPtconnecttlogintpwdtreprtcwdtmirrorsubdir(toptsRRR!tpasswdtaccountthosttporttauthtotat	remotedirtlocaldirtfR"((s//usr/lib64/python2.7/Tools/scripts/ftpmirror.pytmain,s�#

			
				





c#	Cs�	|j�}|rwtjj|�rwtr=dGt|�GHnyt|�Wqwtjk
rs}dGt|�GHdSXntjj|d�}yt	|d�j
�}Wntk
r�}d}nXyt|�}Wn,t
tfk
r�dGt|�GHi}nXg}g}tr!d|fGHn|jd|j�g}	x|D]}
td	kred
Gt|
�GHntr�|
j�}d}|dd
kr�|d }d}nd}
n�|
jdd�}t|�dkr�td	krAdGHqAqAn|dj�}|jd�}|dkrHtd	kr-d|fGHn||d}|| }n|dd!}
|d}d}xStD]K}t||�rltd	kr�dGt|�GdGt|�GHnd	}PqlqlW|r�qAn|ddkrtd	kr�dGt|�GHn|j|�qAn|	j|�|j|�rX|||
krXtd	krAdGt|�GHqAqAntjj||�}tjj|d|�}tr�td||�}|s�|j|�sAd||<qAqAq�nytj|�Wntjk
r�nX|ddkrXtrd ||fGHnytj||�WqUtk
rT}d!||fGHqAqUXn�yt	|d"�}Wn%tk
r�}d!||fGHqAnXtr�d#|||fGHntr�t|d$t j!�}n|}t"j"�}y|j#d%||j$d=�Wnt%j&k
r}|GHnXt"j"�}|j'�}|j(�||krU|j(�nytj|�Wntjk
r|nXytj)||�Wn+tjk
r�}d&|||fGHqAnX|
||<t*||�trA|ddkrA||}|d'}t+t,|��Gd(Gt+t,|��Gd)G||krPd*t+t,||��GHnHqAqAWd}x`|j-�D]R}||	krktr�d+Gt|�Gd,Gt|p�d-�GHn||=|d	}qkqkW|r�t*||�ny.|s�tj.tj/�}ntj.|�}Wntjk
r!g}nXx|D]�}|dd-ks)|j|�s)||kr`q)nd}xStD]K}t||�rmtd	kr�dGt|�GdGt|�GHnd	}PqmqmW|r�q)ntjj||�}t0str)d.Gt|�Gd/GHq)q)ntrd0Gt|�GHnt1|�q)Wxb|D]Z} tr_td1| |�}|s_q2q_ntrwd2Gt| �GHntjj|| �}!|j�}td	kr�d3Gt|�GHd4Gt| �GHny|j2| �Wn3t%j&k
r	}d5Gt| �Gd6Gt|�GHnGXtr$	d7Gt|!�GHnt3||!�td	krE	d8GHn|j2d9�|j�}"|"|krx	d:GHd;GHPq2td	kr2d<GHq2q2WdS(>NsCreating local directorys#Failed to establish local directorys.mirrorinfotrs{}sBad mirror info insListing remote directory %r...tLISTis-->t-i����t/tdR
iisSkipping short lines -> isFound symbolic link %rii����sSkip patterntmatchessRemembering subdirectorysAlready have this version oft@tfiles
Not retrievedtlsCreating symlink %r -> %rsCan't create %r: %stwbsRetrieving %r from %r as %r...isRETR sCan't rename %r to %r: %sg�@s	Kbytes intsecondss(~%d Kbytes/sec)s Removing obsolete info entry fortinR	s
Local filesis no longer pertinentsRemoving local file/dirtsubdirectorysProcessing subdirectorysRemote directory now:s
Remote cwdsCan't chdir toRsMirroring ass
Remote cwd ..s..s,Ended up in wrong directory after cd + cd ..sGiving up now.sOK.i (4R"tostpathtisdirRR#tmakedirRtjointopentreadRtevaltSyntaxErrort	NameErrort	retrlinesRRtstripRRtlentlstriptfindRRthas_keyRtaskabouttunlinktsymlinktLoggingFileRRttimet
retrbinarytwriteRt
error_permttelltclosetrenamet	writedictRtroundtkeystlistdirtcurdirRtremoveR$R%(#R0R/R"Rtinfofilenamettexttinfotsubdirstlistingt
filesfoundtlinetfilenametmodet	infostufftwordstitlinktotskiptpattfullnamettempnametdoittfptfp1tt0tt1tbytestdttkbytest	deletionstnamestnametsubdirtlocalsubdirtnewpwd((s//usr/lib64/python2.7/Tools/scripts/ftpmirror.pyR%is�



		






	

	





"

+

	!

cCstjj|�r�tjj|�r�ytj|�}Wntjk
rTg}nXd}x2|D]*}ttjj||��sbd}qbqbW|s�dSytj|�Wqtjk
r�}d||fGHdSXn:ytj	|�Wn&tjk
r}d||fGHdSXdS(Niis#Can't remove local directory %r: %ssCan't remove local file %r: %s(
R?R@RAtislinkR]RR_RCtrmdirRP(RoRztokR{R((s//usr/lib64/python2.7/Tools/scripts/ftpmirror.pyR_7s,%


RRcBs#eZd�Zd�Zd�ZRS(cCs1||_d|_d|_||_||_dS(Ni(RrRvthashest	blocksizetoutfp(tselfRrR�R�((s//usr/lib64/python2.7/Tools/scripts/ftpmirror.pyt__init__Rs
				cCs�|jt|�|_t|j�|j}x@||jkrn|jjd�|jj�|jd|_q/W|jj|�dS(Nt#i(	RvRKRR�R�R�RUtflushRr(R�tdataR�((s//usr/lib64/python2.7/Tools/scripts/ftpmirror.pyRUXs
cCs|jjd�dS(Ns
(R�RU(R�((s//usr/lib64/python2.7/Tools/scripts/ftpmirror.pyRX`s(t__name__t
__module__R�RURX(((s//usr/lib64/python2.7/Tools/scripts/ftpmirror.pyRRQs		cCsZd|||f}x@t|�j�j�}|d
kr>dS|dkrNdSdGHqdS(NsRetrieve %s %s from %s ? [ny] tytyetyesiR
tntnotnoptnopeisPlease answer yes or no.(R�R�syes(R
R�R�R�R�(t	raw_inputRJtlower(tfiletypeRgR"tprompttreply((s//usr/lib64/python2.7/Tools/scripts/ftpmirror.pyROdscCsOtjj|�rdStjj|�}|r;t|�ntj|d�dS(Ni�(R?R@RAtdirnameRBtmkdir(tpathnameR�((s//usr/lib64/python2.7/Tools/scripts/ftpmirror.pyRBps
c	Cstjj|�\}}tjj|d|�}tjj||d�}ytj|�Wntjk
rqnXt|d�}|jd�x1|j�D]#\}}|jd||f�q�W|jd�|j	�ytj
||�Wntjk
rnXtj
||�dS(NR8t~tws{
s%r: %r,
s}
(R?R@RRCRPRRDRUtitemsRXRY(	tdictRgtdirtfnameRptbackupRrtkeytvalue((s//usr/lib64/python2.7/Tools/scripts/ftpmirror.pyRZzs$


t__main__((RR?RRSR
RRRRRRRRRRR1R%R_RRRORBRZR�(((s//usr/lib64/python2.7/Tools/scripts/ftpmirror.pyt<module>s.		=	�			
	

Zerion Mini Shell 1.0