我想编写bash脚本,递归列出SFTP上的所有文件(包括完整路径),然后在本地与路径进行交互(因此只需要使用SFTP获取路径)。不幸的是,“ls -R”在那里无法工作。
如果有任何基本的POC方法来实现这个功能,将不胜感激。
如果有任何基本的POC方法来实现这个功能,将不胜感激。
Available commands:
bye Quit sftp
cd path Change remote directory to 'path'
chgrp grp path Change group of file 'path' to 'grp'
chmod mode path Change permissions of file 'path' to 'mode'
chown own path Change owner of file 'path' to 'own'
df [-hi] [path] Display statistics for current directory or
filesystem containing 'path'
exit Quit sftp
get [-Ppr] remote [local] Download file
help Display this help text
lcd path Change local directory to 'path'
lls [ls-options [path]] Display local directory listing
lmkdir path Create local directory
ln [-s] oldpath newpath Link remote file (-s for symlink)
lpwd Print local working directory
ls [-1afhlnrSt] [path] Display remote directory listing
lumask umask Set local umask to 'umask'
mkdir path Create remote directory
progress Toggle display of progress meter
put [-Ppr] local [remote] Upload file
pwd Display remote working directory
quit Quit sftp
rename oldpath newpath Rename remote file
rm path Delete remote file
rmdir path Remove remote directory
symlink oldpath newpath Symlink remote file
version Show SFTP version
!command Execute 'command' in local shell
! Escape to local shell
? Synonym for help
echo
和cd
的解决方案,但显然服务器甚至没有echo
命令,你能验证一下吗?如果是真的,那么就无法实现你的目标。 - ShellFish