Hi, I am new to scp. I am trying to scp a file from local (m/c) to remote through a java application running in Tomcat. When I try to upload a file with no spaces in it, it works. But if spaces are present (file name is : "Lots of spaces text .txt") it is not working. Some of the things I tried are mentioned below and they failed. scp [...options] '/vhosts/dw02411/tmp_daemon/1020046111/Lots of spaces text .txt' grt0002d at loninwebp7.uk.db.com:uploads scp [...options] /vhosts/dw02411/tmp_daemon/1020046111/Lots\\ of\\ spaces\\ text\\ .txt grt0002d at loninwebp7.uk.db.com:uploads scp [...options] /vhosts/dw02411/tmp_daemon/1020046111/Lots\ of\ spaces\ text\ .txt grt0002d at loninwebp7.uk.db.com:uploads scp [...options] /vhosts/dw02411/tmp_daemon/1020046111/"Lots of spaces text .txt" grt0002d at loninwebp7.uk.db.com:uploads scp [...options] /vhosts/dw02411/tmp_daemon/1020046111//"Lots of spaces text .txt/" grt0002d at loninwebp7.uk.db.com:uploads Is there any other way of running the command for scp from java application? Thanks in advance. Vinit ********************************************************************* Disclaimer: The information in this e-mail and any attachments is confidential / privileged. It is intended solely for the addressee or addressees. If you are not the addressee indicated in this message, you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. Please advise immediately if you or your employer does not consent to Internet email for messages of this kind. *********************************************************************
Ladner, Eric (Eric.Ladner)
2003-Sep-08 19:44 UTC
doing scp from java when file has spaces in it
Did you try this: scp [...options] "/vhosts/dw02411/tmp_daemon/1020046111/Lots of spaces text.txt" grt0002d at loninwebp7.uk.db.com:uploads (although, I'm surprised the one with single quotes failed). What OS is this on? What command line shell? Escaping of spaces is depending on the environment you are in, not what kind of scp binary you use. The first, third and fourth examples should have worked in a Bourne shell, Korn shell or BASH (I think). Eric -----Original Message----- From: Vinit Khandelwal [mailto:vinit.k at sonata-software.com] Sent: Friday, September 05, 2003 12:42 AM To: openssh-unix-dev at mindrot.org Subject: doing scp from java when file has spaces in it Hi, I am new to scp. I am trying to scp a file from local (m/c) to remote through a java application running in Tomcat. When I try to upload a file with no spaces in it, it works. But if spaces are present (file name is : "Lots of spaces text .txt") it is not working. Some of the things I tried are mentioned below and they failed. scp [...options] '/vhosts/dw02411/tmp_daemon/1020046111/Lots of spaces text .txt' grt0002d at loninwebp7.uk.db.com:uploads scp [...options] /vhosts/dw02411/tmp_daemon/1020046111/Lots\\ of\\ spaces\\ text\\ .txt grt0002d at loninwebp7.uk.db.com:uploads scp [...options] /vhosts/dw02411/tmp_daemon/1020046111/Lots\ of\ spaces\ text\ .txt grt0002d at loninwebp7.uk.db.com:uploads scp [...options] /vhosts/dw02411/tmp_daemon/1020046111/"Lots of spaces text .txt" grt0002d at loninwebp7.uk.db.com:uploads scp [...options] /vhosts/dw02411/tmp_daemon/1020046111//"Lots of spaces text .txt/" grt0002d at loninwebp7.uk.db.com:uploads Is there any other way of running the command for scp from java application? Thanks in advance. Vinit ********************************************************************* Disclaimer: The information in this e-mail and any attachments is confidential / privileged. It is intended solely for the addressee or addressees. If you are not the addressee indicated in this message, you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. Please advise immediately if you or your employer does not consent to Internet email for messages of this kind. ********************************************************************* _______________________________________________ openssh-unix-dev mailing list openssh-unix-dev at mindrot.org http://www.mindrot.org/mailman/listinfo/openssh-unix-dev