summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2011-08-12 15:46:44 +0300
committerJohan Hedberg <johan.hedberg@intel.com>2011-08-22 10:36:46 +0300
commit784461e9b9ed3dc7e36f915206308953732f5979 (patch)
tree33f8e30897684e0e375625062b280564f8555bd2 /test
parent0b23cae9c77f07c5f7d4add4a9c497905a27be6b (diff)
downloadobexd-784461e9b9ed3dc7e36f915206308953732f5979.tar.gz
Add move and copy support to ftp-client
Diffstat (limited to 'test')
-rwxr-xr-xtest/ftp-client24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ftp-client b/test/ftp-client
index 4cb4ee5..9bc038d 100755
--- a/test/ftp-client
+++ b/test/ftp-client
@@ -56,6 +56,12 @@ def parse_options():
help="Get FILE", metavar="FILE")
parser.add_option("-p", "--put", dest="put_file",
help="Put FILE", metavar="FILE")
+ parser.add_option("-y", "--copy", dest="copy_file",
+ help="Copy FILE", metavar="FILE")
+ parser.add_option("-m", "--move", dest="move_file",
+ help="Move FILE", metavar="FILE")
+ parser.add_option("-n", "--destname", dest="dest_file",
+ help="Destination FILE", metavar="FILE")
parser.add_option("-r", "--remove", dest="remove_file",
help="Remove FILE", metavar="FILE")
parser.add_option("-v", "--verbose", action="store_true", dest="verbose")
@@ -96,6 +102,18 @@ def remove_file(session, filename):
reply_handler=void_reply,
error_handler=error)
+def move_file(session, filename, destname):
+ session.MoveFile(filename,
+ destname,
+ reply_handler=void_reply,
+ error_handler=error)
+
+def copy_file(session, filename, destname):
+ session.CopyFile(filename,
+ destname,
+ reply_handler=void_reply,
+ error_handler=error)
+
if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@@ -140,6 +158,12 @@ if __name__ == '__main__':
if options.put_file:
put_file(ftp, options.put_file)
+ if options.move_file:
+ move_file(ftp, options.move_file, options.dest_file)
+
+ if options.copy_file:
+ copy_file(ftp, options.copy_file, options.dest_file)
+
if options.remove_file:
remove_file(ftp, options.remove_file)