Created
April 12, 2023 03:01
-
-
Save anil1kuppa/33f6e53146ce08442f704e85b03aa3b2 to your computer and use it in GitHub Desktop.
List the number of files in sftp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "ls *.csv" | sftp -q <username>@<hostname>:<directory> | grep -v '^stfp>' | wc -l | |
// E.g. echo "ls *.csv" | sftp -q [email protected]:/nfiIndustries | grep -v '^stfp>' | wc -l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
username= | |
hostname= | |
currentdir= | |
filename= | |
( | |
echo cd $currentdir | |
for file in `(sed -n -e '1,2p' $filename)` | |
do | |
echo rename $file /nfiIndustries/Historical_candidate_`echo $file|cut -d'_' -f2-` | |
done | |
)|sftp $username@$hostname |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment