Guest User

Untitled

a guest
Mar 23rd, 2018
626
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. localpath=/home/localacct/somepath
  4. remotelocation=/home/account/logs/archive
  5. remotehost=' account@1.1.1.1'
  6.  
  7. echo > $localpath/list.sftp
  8. echo "cd $remotelocation " >> $localpath/list.sftp
  9. echo "dir *.* " >> $localpath/list.sftp
  10. echo "dir *.* > $localpath/dirlist.txt " >> $localpath/list.sftp
  11. echo "bye " >> $localpath/list.sftp
  12. sftp -b $localpath/list.sftp $remotehost
  13.  
  14. exit
  15.  
  16. mkdir remote
  17. sshfs "$remotehost:$remotelocation" remote
  18. cd remote
  19.  
  20. echo *.* >"$localpath/dirlist.txt"
  21.  
  22. fusermount -u remote
  23. rmdir remote
  24.  
  25. sftp> pwd
  26. Remote working directory: /var/tmp/foodir
  27. sftp> lcd /var/tmp/foodir
  28. sftp> dir *.*
  29. foo.txt
  30. sftp> dir *.* >dirlist.txt
  31. foo.txt
  32. sftp> dir
  33. foo.txt
  34. sftp>
  35.  
  36. ls [-1afhlnrSt] [path]
  37. Display a remote directory listing of either path or the current directory if path is not specified. path may contain glob(3) characters and may match mul‐
  38. tiple files.
  39.  
  40. The following flags are recognized and alter the behaviour of ls accordingly:
  41.  
  42. -1 Produce single columnar output.
  43.  
  44. -a List files beginning with a dot (‘.’).
  45.  
  46. -f Do not sort the listing. The default sort order is lexicographical.
  47.  
  48. -h When used with a long format option, use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte, Petabyte, and Exabyte in order to reduce the
  49. number of digits to four or fewer using powers of 2 for sizes (K=1024, M=1048576, etc.).
  50.  
  51. -l Display additional details including permissions and ownership information.
  52.  
  53. -n Produce a long listing with user and group information presented numerically.
  54.  
  55. -r Reverse the sort order of the listing.
  56.  
  57. -S Sort the listing by file size.
  58.  
  59. -t Sort the listing by last modification time.
  60.  
  61. #!/usr/bin/expect
  62. spawn sftp username@reports.paypal.com:/ppreports/outgoing
  63. expect "password:"
  64. send "XXXXXXXXXXn"
  65. expect "sftp>"
  66. log_file -noappend RemoteFileList.txt
  67. send "ls -1n"
  68. expect "sftp>"
  69. log_file
  70. send "!sed -i '' '/ls -1/d' ./RemoteFileList.txtn"
  71. expect "sftp>"
  72. send "!sed -i '' '/sftp>/d' ./RemoteFileList.txtn"
  73. expect "sftp>"
  74. send "byen"
  75. interact
  76.  
  77. #!/bin/bash
  78. localpath=/home/local-acct/path
  79. remotelocation=/home/account/logs/archive
  80. remotehost=' account@1.2.3.4'
  81. rsync -avz $remotehost:/$remotelocation > $localpath/dirlist.txt
  82. exit
  83.  
  84. lftp -c 'connect sftp://user:password@host/dir; ls' > list.txt
  85.  
  86. lftp -e 'ls;quit' sftp://user:password@host/dir > list.txt
  87.  
  88. LFTP_PASSWORD=password lftp --env-password -e 'ls;quit'
  89. sftp://user:password@host/dir > file.list
  90.  
  91. lftp <<'EOF' > file.list
  92. connect sftp://user:password@host/dir
  93. ls
  94. EOF
Add Comment
Please, Sign In to add comment