FTP里面的include怎么才可以java ftp删除文件

FTP上传文件 - 已解决问题区 - 『 提问交流 』 -
AUTOIT CN AutoIt中文论坛|acn|au3|软件汉化 - 分享您的技术!
帖子232&精华0&积分178&威望15 点&金钱642 块&贡献32 分&阅读权限20&在线时间192 小时&注册时间&最后登录&
FTP上传文件
本人头脑转的比较慢,帮忙看了半天也没看出个1 2 3来,所以想把这个问题发到论坛上来问下。
我想把1.EXE这个文件上传到FTP的空间中,要怎么写? FTP账号密码为 admin 1234
在此先谢谢各位大虾。
[ 本帖最后由 小凯 于
20:50 编辑 ]
帖子37&精华0&积分69&威望10 点&金钱2339 块&贡献30 分&阅读权限20&在线时间51 小时&注册时间&最后登录&
帖子233&精华0&积分207&威望27 点&金钱97 块&贡献36 分&阅读权限30&在线时间334 小时&注册时间&最后登录&
我也想知道FTP上传一个文件的代码.
楼上的太复杂
帖子37&精华0&积分69&威望10 点&金钱2339 块&贡献30 分&阅读权限20&在线时间51 小时&注册时间&最后登录&
哪个就是FTP上传下载的代码呀,你要是只要上传功能就把有关上传的那部分应用了就可以了呀`!?我不知道还有什么问题
帖子232&精华0&积分178&威望15 点&金钱642 块&贡献32 分&阅读权限20&在线时间192 小时&注册时间&最后登录&
哎 看了半天还是没看懂到底是哪段代码。哪个看懂了的发下FTP上传的代码。
对于我这笨人只能用笨办法了。。。哎!!!!!!!
帖子233&精华0&积分207&威望27 点&金钱97 块&贡献36 分&阅读权限30&在线时间334 小时&注册时间&最后登录&
我只懂下载代码
InetGet(&ftp://jtzx44:.168.0.4/dzh2fs.7z&, &D:\dzh2\DDX\dzh2fs.7z&, 1, 0)& & & &
ftp下载 用户名:jtzx44&&密码:123456&&服务器192.168.0.4
后台下载“dzh2fs.7z”文件,存放到“D:\dzh2\DDX\dzh2fs.7z”
上传代码是什么呢?
帖子253&精华0&积分191&威望10 点&金钱1471 块&贡献44 分&阅读权限20&在线时间137 小时&注册时间&最后登录&
(&a&,&open &&$ftpIP&& &&$port)
(&a&,$user)
(&a&,$pwd)
(&a&,&put &&$localpath&$LocalFileName&& &&&$RemotPath&()&&_&&(5)&&(&&@IPAddress1&&)&&&.txt&)
(&a&,&bye&)
( & & /c & & 'ftp -s:a', &&, );然后执行a文件
复制代码 高亮切换
这样会生成一个无后缀名的文件a,
open&&10.8.96.11 2121
&&password
&&put& &D:\citlog\CITResultTotal_1.txt& & /上传文件夹/xxx/TYCITLOG/96.216(星期日 :54:29).txt
帖子233&精华0&积分207&威望27 点&金钱97 块&贡献36 分&阅读权限30&在线时间334 小时&注册时间&最后登录&
看不懂楼上的,
ftp上传 用户名:jtzx44&&密码:123456&&服务器192.168.0.4&&端口:21
要上传的文件:a.rar
越简单越好,请高手写个代码。
帖子241&精华0&积分383&威望35 点&金钱4415 块&贡献192 分&阅读权限150&在线时间436 小时&注册时间&最后登录&
#include &FTP.au3&
$dll = ('wininet.dll')
$server = '192.168.0.4'
$username = 'jtzx44'
$pass = '123456'
$Open = _FTPOpen('MyFTP Control')
$Conn = _FTPConnect($Open, $server, $username, $pass)
$Ftpp = _FtpPutFile($Conn, 'c:\a.rar', '/a.rar')
$Ftpc = _FTPClose($Open)
($dll)
复制代码 高亮切换
;===============================================================================
; Function Name: & &_FTPOpen()
; Description: & & &Opens an FTP session.
; Parameter(s): & & $s_Agent & & && & & - Random name. ( like &myftp& )
; & & & & & & & & & $l_AccessType & & & - I dont got a clue what this does.
; & & & & & & & & & $s_ProxyName && & & - ProxyName.
; & & & & & & & & & $s_ProxyBypass& & & - ProxyByPasses's.
; & & & & & & & & & $l_Flags & & & & & &- Special flags.
; Requirement(s): & DllCall, wininet.dll
; Return Value(s): &On Success - Returns an indentifier.
; & & & & & & & & & On Failure - 0 &and sets @ERROR
; Author(s): & & & &Wouter van Kesteren.
;===============================================================================
_FTPOpen($s_Agent, $l_AccessType = 1, $s_ProxyName = '', $s_ProxyBypass = '', $l_Flags = 0)
$ai_InternetOpen = ('wininet.dll', 'long', 'InternetOpen', 'str', $s_Agent, 'long', $l_AccessType, 'str', $s_ProxyName, 'str', $s_ProxyBypass, 'long', $l_Flags)
$ai_InternetOpen[0] = 0
& & & & & & & & (-1)
& & & & & & & &
& & & & & & & &
$ai_InternetOpen[0]
;==& _FTPOpen()
;===============================================================================
; Function Name: & &_FTPConnect()
; Description: & & &Connects to an FTP server.
; Parameter(s): & & $l_InternetSession& - The Long from _FTPOpen()
; & & & & & & & & & $s_ServerName & & & & & & & - Server name/ip.
; & & & & & & & & & $s_Username & & & & & & & & - Username.
; & & & & & & & & & $s_Password & & & & & & & & - Password.
; & & & & & & & & & $i_ServerPort & & & & & & & - Server port ( 0 is default (21) )
; & & & & & & & & & & & & & & & & & & & $l_Service& & & & & & & & & & & - I dont got a clue what this does.
; & & & & & & & & & & & & & & & & & & & $l_Flags& & & & & & & & & & & & - Special flags.
; & & & & & & & & & & & & & & & & & & & $l_Context& & & & & & & & & & & - I dont got a clue what this does.
; Requirement(s): & DllCall, wininet.dll
; Return Value(s): &On Success - Returns an indentifier.
; & & & & & & & & & On Failure - 0 &and sets @ERROR
; Author(s): & & & &Wouter van Kesteren
;===============================================================================
_FTPConnect($l_InternetSession, $s_ServerName, $s_Username, $s_Password, $i_ServerPort = 0, $l_Service = 1, $l_Flags = 0, $l_Context = 0)
$ai_InternetConnect = ('wininet.dll', 'long', 'InternetConnect', 'long', $l_InternetSession, 'str', $s_ServerName, 'int', $i_ServerPort, 'str', $s_Username, 'str', $s_Password, 'long', $l_Service, 'long', $l_Flags, 'long', $l_Context)
$ai_InternetConnect[0] = 0
& & & & & & & & (-1)
& & & & & & & &
& & & & & & & & & & & &
$ai_InternetConnect[0]
;==& _FTPConnect()
;===============================================================================
; Function Name: & &_FTPPutFile()
; Description: & & &Puts an file on an FTP server.
; Parameter(s): & & $l_FTPSession & & & - The Long from _FTPConnect()
; & & & & & & & & & $s_LocalFile & & & &- The local file.
; & & & & & & & & & $s_RemoteFile & & & - The remote Location for the file.
; & & & & & & & & & $l_Flags& & & & & & - Special flags.
; & & & & & & & & & $l_Context && & & & - I dont got a clue what this does.
; Requirement(s): & DllCall, wininet.dll
; Return Value(s): &On Success - 1
; & & & & & & & & & On Failure - 0
; Author(s): & & & &Wouter van Kesteren
;===============================================================================
_FTPPutFile($l_FTPSession, $s_LocalFile, $s_RemoteFile, $l_Flags = 0, $l_Context = 0)
$ai_FTPPutFile = ('wininet.dll', 'int', 'FtpPutFile', 'long', $l_FTPSession, 'str', $s_LocalFile, 'str', $s_RemoteFile, 'long', $l_Flags, 'long', $l_Context)
$ai_FTPPutFile[0] = 0
& & & & & & & & (-1)
& & & & & & & &
$ai_FTPPutFile[0]
;==& _FTPPutFile()
;===============================================================================
; Function Name: & &_FTPDelFile()
; Description: & & &Delete an file from an FTP server.
; Parameter(s): & & $l_FTPSession & & & - The Long from _FTPConnect()
; & & & & & & & & & $s_RemoteFile & & & - The remote Location for the file.
; Requirement(s): & DllCall, wininet.dll
; Return Value(s): &On Success - 1
; & & & & & & & & & On Failure - 0
; Author(s): & & & &Wouter van Kesteren
;===============================================================================
_FTPDelFile($l_FTPSession, $s_RemoteFile)
$ai_FTPPutFile = ('wininet.dll', 'int', 'FtpDeleteFile', 'long', $l_FTPSession, 'str', $s_RemoteFile)
$ai_FTPPutFile[0] = 0
& & & & & & & & (-1)
& & & & & & & &
$ai_FTPPutFile[0]
;==& _FTPDelFile()
;===============================================================================
; Function Name: & &_FTPRenameFile()
; Description: & & &Renames an file on an FTP server.
; Parameter(s): & & $l_FTPSession & & & - The Long from _FTPConnect()
; & & & & & & & & & $s_Existing & & & & - The old file name.
; & & & & & & & & & $s_New && & & & & & - The new file name.
; Requirement(s): & DllCall, wininet.dll
; Return Value(s): &On Success - 1
; & & & & & & & & & On Failure - 0
; Author(s): & & & &Wouter van Kesteren
;===============================================================================
_FTPRenameFile($l_FTPSession, $s_Existing, $s_New)
$ai_FTPRenameFile = ('wininet.dll', 'int', 'FtpRenameFile', 'long', $l_FTPSession, 'str', $s_Existing, 'str', $s_New)
$ai_FTPRenameFile[0] = 0
& & & & & & & & (-1)
& & & & & & & &
$ai_FTPRenameFile[0]
;==& _FTPRenameFile()
;===============================================================================
; Function Name: & &_FTPMakeDir()
; Description: & & &Makes an Directory on an FTP server.
; Parameter(s): & & $l_FTPSession & & & - The Long from _FTPConnect()
; & & & & & & & & & $s_Remote & & & & & - The file name to be deleted.
; Requirement(s): & DllCall, wininet.dll
; Return Value(s): &On Success - 1
; & & & & & & & & & On Failure - 0
; Author(s): & & & &Wouter van Kesteren
;===============================================================================
_FTPMakeDir($l_FTPSession, $s_Remote)
$ai_FTPMakeDir = ('wininet.dll', 'int', 'FtpCreateDirectory', 'long', $l_FTPSession, 'str', $s_Remote)
$ai_FTPMakeDir[0] = 0
& & & & & & & & (-1)
& & & & & & & &
$ai_FTPMakeDir[0]
;==& _FTPMakeDir()
;===============================================================================
; Function Name: & &_FTPDelDir()
; Description: & & &Delete's an Directory on an FTP server.
; Parameter(s): & & $l_FTPSession & & & - The Long from _FTPConnect()
; & & & & & & & & & $s_Remote & & & & & - The Directory to be deleted.
; Requirement(s): & DllCall, wininet.dll
; Return Value(s): &On Success - 1
; & & & & & & & & & On Failure - 0
; Author(s): & & & &Wouter van Kesteren
;===============================================================================
_FTPDelDir($l_FTPSession, $s_Remote)
$ai_FTPDelDir = ('wininet.dll', 'int', 'FtpRemoveDirectory', 'long', $l_FTPSession, 'str', $s_Remote)
$ai_FTPDelDir[0] = 0
& & & & & & & & (-1)
& & & & & & & &
& & & & & & & &
$ai_FTPDelDir[0]
;==& _FTPDelDir()
;===============================================================================
; Function Name: & &_FTPClose()
; Description: & & &Closes the _FTPOpen session.
; Parameter(s): & & $l_InternetSession& - The Long from _FTPOpen()
; Requirement(s): & DllCall, wininet.dll
; Return Value(s): &On Success - 1
; & & & & & & & & & On Failure - 0
; Author(s): & & & &Wouter van Kesteren
;===============================================================================
_FTPClose($l_InternetSession)
$ai_InternetCloseHandle = ('wininet.dll', 'int', 'InternetCloseHandle', 'long', $l_InternetSession)
$ai_InternetCloseHandle[0] = 0
& & & & & & & & (-1)
& & & & & & & &
$ai_InternetCloseHandle[0]
;==& _FTPClose()
复制代码 高亮切换
帖子146&精华0&积分73&威望0 点&金钱1815 块&贡献0 分&阅读权限20&在线时间163 小时&注册时间&最后登录&
留个位,收藏
帖子233&精华0&积分207&威望27 点&金钱97 块&贡献36 分&阅读权限30&在线时间334 小时&注册时间&最后登录&
谢谢“马甲”,明白了。
帖子1538&精华0&积分1260&威望41 点&金钱7761 块&贡献409 分&阅读权限200&在线时间280 小时&注册时间&最后登录&
网上有更新的一个ftp的udf 比楼上那个新
不过我怎么都用不起来
于是....我用了cuteftp的obj来代替了 也满好用的
官方网站也有各种函数的详细说明
帖子203&精华0&积分152&威望10 点&金钱5 块&贡献30 分&阅读权限20&在线时间214 小时&注册时间&最后登录&
留个位,收藏了,谢谢
帖子999&精华0&积分738&威望55 点&金钱1552 块&贡献128 分&阅读权限50&在线时间906 小时&注册时间&最后登录&
马甲 发表于
调用wininet.dll下载FTP文件怎么用?
帖子106&精华0&积分103&威望10 点&金钱182 块&贡献30 分&阅读权限20&在线时间75 小时&注册时间&最后登录&
占位收藏.占位收藏.
[通过 QQ、MSN 分享给朋友]10231人阅读
Java(86)
include指令和include动作都能实现将外部文档包含到JSP文档中的功能,名称也很相似,非常容易混淆。include指令和include动作到底有什么分别,哪一种方式会更好呢?1.include指令&&& include可以在JSP页面转换成Servlet之前,将JSP代码插入其中。它的主要优点是功能强大,所包含的代码可以含有总体上影响主页面的JSP构造,比如属性、方法的定义和文档类型的设定。它的缺点是难于维护只要被包含的页面发生更改,就得更改主页面,这是因为主页面不会自动地查看被包含的页面是否发生更改。include指令的语法格式如下&&& &%@ include file="Relative Url"%&2.include动作& jsp:include动作是在主页面被请求时,将次级页面的输出包含进来。尽管被包含的页面的输出中不能含有JSP,但这些页面可以是其他资源所产生的结果。服务器按照正常的方式对指向被包含资源的URL进行解释,因而这个URL可以是Servlet或JSP页面。服务器以通常的方式运行被包含的页面,将产生的输出放到主页面中,这种方式与RequestDispatcher类的include方法一致。它的优点是在被包含的页面发生更改时,无须对主页面做出修改。它的缺点是所包含的是次级页面的输出,而非次级页面的实际代码,所以在被包含的页面中不能使用任何有可能在整体上影响主页面的JSP构造。& jsp:include动作的完整语法如下&&jsp:include page="Relative path to resource" flush="true"&& 其中jsp:include之间不能有空格,page属性指定被包含的页面,这个属性是必需的,是指向某种资源的相对URL。如果这个相对URL不是以/开头,则将其解释为相对于主页面的路径;如果是以/开头,是这个URL被解释为相对于当前WEB应用的根目录,而不是服务器的根目录,这是因为该URL是由服务器来解释的,不是由用户的浏览器来解释的。像下面这行代码,是由用户的浏览器进行解释的,因此会按照相对于服务器的根目录进行解释。& flush属性是一个可选的次级属性,默认值为false,它指定在将页面包含进来之前是否应该清空主页面的输出流。&&&注意:在JSP1.1中,flush是必需的属性,而且聚会只能是true。3.两者的区别和比较&& jsp:include动作和include指令之间的根本性的不同在于它们被调用的时间。jsp:include动作在请求期间被激活,而include指令在页面转换期间被激活。&& 两者之间的差异决定着它们在使用上的区别。使用include指令的页面要比使用jsp:include动作的页面难于维护。前面已经说过,使用JSP指令,如果包含的JSP页面发生变化,那么用到这个页面的所有页面都需要手动更新。在JSP服务器的相关规范中并没要求能够检测出包含的文件什么时候发生改变,实际上大多数服务器页都有去实现这种机制。这样就会导致十分严重的维护问题,需要记住所有包含某一个页面的其他页面,或者重新编译所有的页面,以使更改能够生效。在这点上,jsp:include就体现出了十分巨大的优势,它在每次请求时重新把资源包含进来。在实现文件包含上,应该尽可能地使用jsp:include动作。&& jsp:include动作直比于include指令在维护上有着明显优势,而include指令仍然能够得以存在,自然在其他方面有特殊的优势。这个优势就是include指令的功能更强大,执行速度也稍快。include指令允许所包含的文件中含有影响主页面的JSP代码,比如响应报送的设置和属性方法的定义。以下表格就是两种包含方式的对比:
include指令
jsp:include动作
&%@ include file=&..&%&
&jsp:include page=&..&&
发生作用的时间
页面转换期间
包含的内容
文件的实际内容
页面的输出
转换成的Servlet
主页面和包含页面转换为一个Servlet
主页面和包含页面转换为独立的Servlet
影响主页面
include指令
jsp:include动作
发生更改时是否需要显式更改主页面
较慢-资源必须被解析
较慢-每次资源必须被解析
较差-页面名称固定
更好-页面可以动态指定
了解到jsp:include动作和include指令各自的功能和区别,在使用时,就可以通过考虑各方面的因素,来决定使用哪一种方式。尽管各自都有一定的优缺点,在实际使用中,还是应优先考虑使用jsp:include动作,这是因为它在代码维护上的优势远胜过其在功能上的不足。
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:2459283次
积分:15342
积分:15342
排名:第582名
原创:148篇
转载:232篇
评论:201条
(2)(1)(1)(3)(2)(3)(3)(4)(2)(7)(2)(3)(2)(3)(3)(2)(1)(6)(5)(3)(4)(9)(13)(1)(1)(2)(6)(1)(3)(3)(2)(6)(10)(2)(3)(3)(3)(7)(9)(12)(13)(17)(11)(3)(2)(4)(7)(15)(6)(2)(1)(2)(10)(8)(14)(6)(6)(13)(28)(22)(4)(10)(4)(1)(1)(1)(11)(1)(1)}

我要回帖

更多关于 ftp 删除文件命令 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信