sftp how to deal with space in path to dir?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sftp how to deal with space in path to dir?
# 1  
Old 02-04-2009
sftp how to deal with space in path to dir?

OK I am trying to use something similar to this:

Code:
#!/bin/sh
  echo "OK, starting now..."
  sftp -b /dev/fd/0 user@remotehost <<EOF
  cd pub
  ascii
  put filename.txt
  bye
  EOF

only difference is the dir I need to cd to has a space in it like this

/Import/Server/Prospect File

, how do I deal with that?

Also I understand how to use ssh-keygen to generate a key pair and send them my public key. And if I was using scp I would use the -i option to direct scp to use the private id file on my end, but how do I do that with sftp? I have maned sftp and I don't see an option for designating an id file to use like "-i" in scp?
# 2  
Old 02-04-2009
double quotes worked for me:

cd "dir with spaces"
# 3  
Old 02-04-2009
yep worked for me, I should have tried that before I asked..

Sorry for the dumb question, but thanks for the help!

Now I just have to figure out how to direct it to use a private key???
# 4  
Old 02-04-2009
OK figured it out you just have to use the -o like this:
sftp -o IdentityFile=${IdFile} -b ${BatchFile} user@server
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. OS X (Apple)

Can I mount partition at given dir path

Hi, In Linux, I had modified fstab file which used to mount ~/Music, ~/Pictures, etc with disk partitions containing corresponding content or binding directory located at other partition. But I am wondering can I do same in El-Capitan as well? No linking! /media/L-Store/Desktop/Documents ... (0 Replies)
Discussion started by: ezee
0 Replies

2. UNIX for Dummies Questions & Answers

Cannot cd to dir with space

I have a script that I am trying to use. I need it to run from a certain directory. I have tried the following: SCRIPT_DIR=$PWD MYDIR="/filemount/files/Move Files" cd "$MYDIR" $SCRIPT_DIR/movefiles.bash I have tried to run it. but I always get "no such file or directory" from the script... (5 Replies)
Discussion started by: newbie2010
5 Replies

3. Shell Programming and Scripting

Wild card for dir path

I have dir structure like this : /opt/oracle/product/abc/sqlplus/admin/ /opt/oracle/product/def/sqlplus/admin /opt/oracle/product/ghi/sqlplus/admin I am trying to use wildcard ( for dirs abc,def,ghi) ..something like this : cp xyz.txt ... (1 Reply)
Discussion started by: talashil
1 Replies

4. Shell Programming and Scripting

how to get the scripts full dir path

lyang0@lyang0-OptiPlex-755:~$ ./test.sh . lyang0@lyang0-OptiPlex-755:~$ cat test.sh #!/bin/bash echo `dirname $0` lyang0@lyang0-OptiPlex-755:~$ pwd /home/lyang0 it doesn't get "/home/lyang0" and only when run /home/lyang0/test.sh it will get, but how can I do, then it can get the real... (8 Replies)
Discussion started by: yanglei_fage
8 Replies

5. Shell Programming and Scripting

How to deal files with space in names?

I have a bash file as following: #!/bin/sh deal_file(){ printf $1 printf "\t is a file" echo } main(){ for file in `find "$1" ` do deal_file $file done } main $1 then I run ./t.sh .,get the following results: (1 Reply)
Discussion started by: 915086731
1 Replies

6. Linux

SFTP user access restriction to his home dir

Hi Friends, I have installed a FTP Server on my Linux machine (Fedora 11). I want the ftp users to be restricted to their own home dir using sftp. But the said condition is met when the user logs in using ftp over port 21 and when the user logs in using sftp i.e. protocol 22, he/she has... (4 Replies)
Discussion started by: pashy
4 Replies

7. Shell Programming and Scripting

How do I define a particular dir in PATH variable and then unset that dir

How do I define a particular dir in front of PATH variable and then run some job and then at the end of job SET the PATH variable to original? in a script, WILL something like this work: ORIG_PATH=$PATH export PATH=/dir1/dir2:$PATH RUN SOME JOBS ..... unset PATH EXPORT... (2 Replies)
Discussion started by: Hangman2
2 Replies

8. Shell Programming and Scripting

full path of a file situated either in parent's dir. or parent's parent dir. so on...

hi experts(novice people can stay away as it is no child's game), i am developing a script which works like recycle bin of windows. the problem i am facing is that when ever i am trying to delete a file which is situated in parent directory or parent's parent directory i am unable to... (1 Reply)
Discussion started by: yahoo!
1 Replies

9. UNIX for Dummies Questions & Answers

Need to know path of dir currently in.

Which command will help us to get the directory path? (4 Replies)
Discussion started by: videsh77
4 Replies

10. UNIX for Dummies Questions & Answers

Finding current working dir path

Hi Folks, In a Unix (ksh) script, is there a way to determine the current working directory path of another logged-in user? Of course, I can use "pwd" to find my own path. But, how do I find it for another active user? Thanks for any input you can provide. LY (6 Replies)
Discussion started by: liteyear18
6 Replies
Login or Register to Ask a Question