Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- localpath=/home/localacct/somepath
- remotelocation=/home/account/logs/archive
- remotehost=' account@1.1.1.1'
- echo > $localpath/list.sftp
- echo "cd $remotelocation " >> $localpath/list.sftp
- echo "dir *.* " >> $localpath/list.sftp
- echo "dir *.* > $localpath/dirlist.txt " >> $localpath/list.sftp
- echo "bye " >> $localpath/list.sftp
- sftp -b $localpath/list.sftp $remotehost
- exit
- mkdir remote
- sshfs "$remotehost:$remotelocation" remote
- cd remote
- echo *.* >"$localpath/dirlist.txt"
- fusermount -u remote
- rmdir remote
- sftp> pwd
- Remote working directory: /var/tmp/foodir
- sftp> lcd /var/tmp/foodir
- sftp> dir *.*
- foo.txt
- sftp> dir *.* >dirlist.txt
- foo.txt
- sftp> dir
- foo.txt
- sftp>
- ls [-1afhlnrSt] [path]
- 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‐
- tiple files.
- The following flags are recognized and alter the behaviour of ls accordingly:
- -1 Produce single columnar output.
- -a List files beginning with a dot (‘.’).
- -f Do not sort the listing. The default sort order is lexicographical.
- -h When used with a long format option, use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte, Petabyte, and Exabyte in order to reduce the
- number of digits to four or fewer using powers of 2 for sizes (K=1024, M=1048576, etc.).
- -l Display additional details including permissions and ownership information.
- -n Produce a long listing with user and group information presented numerically.
- -r Reverse the sort order of the listing.
- -S Sort the listing by file size.
- -t Sort the listing by last modification time.
- #!/usr/bin/expect
- spawn sftp username@reports.paypal.com:/ppreports/outgoing
- expect "password:"
- send "XXXXXXXXXXn"
- expect "sftp>"
- log_file -noappend RemoteFileList.txt
- send "ls -1n"
- expect "sftp>"
- log_file
- send "!sed -i '' '/ls -1/d' ./RemoteFileList.txtn"
- expect "sftp>"
- send "!sed -i '' '/sftp>/d' ./RemoteFileList.txtn"
- expect "sftp>"
- send "byen"
- interact
- #!/bin/bash
- localpath=/home/local-acct/path
- remotelocation=/home/account/logs/archive
- remotehost=' account@1.2.3.4'
- rsync -avz $remotehost:/$remotelocation > $localpath/dirlist.txt
- exit
- lftp -c 'connect sftp://user:password@host/dir; ls' > list.txt
- lftp -e 'ls;quit' sftp://user:password@host/dir > list.txt
- LFTP_PASSWORD=password lftp --env-password -e 'ls;quit'
- sftp://user:password@host/dir > file.list
- lftp <<'EOF' > file.list
- connect sftp://user:password@host/dir
- ls
- EOF
Add Comment
Please, Sign In to add comment