chinni005 Posted January 5, 2015 Author Report Posted January 5, 2015 if test -s ''$filename'' then echo ''exist'' else echo ''doesn't exist'' fi this didn't work over FTP bye1
ramafdb Posted January 5, 2015 Report Posted January 5, 2015 this didn't work over FTP bye1 connect ayyava first asalu
Keratam Posted January 5, 2015 Report Posted January 5, 2015 why do u need a script to connect ftp.. ftp <servername> <username> <password> enuf ryt?? he is using that in script so it will be easy and listing the files in the same script
Keratam Posted January 5, 2015 Report Posted January 5, 2015 weird thing enti ante I have 3 files in the remote location 323232.xml chinni005 keretam 32323.pdf chilligaari spiderreddy official.pdf same ilage 3 files unnayi including spaces and all the file names are same format, when I do "ls 323232.xml" it is giving me correct results but when I do "ls chinni005 keretam 32323.pdf" it is giving me the error "usage: ls remote-directory local-file" please Help..!! $filename =~ s/\s/\\ /g;$ftp->dir($filename);This is the correct way to escape the whitespaces.
chinni005 Posted January 5, 2015 Author Report Posted January 5, 2015 okay all, using ls "$filename" is giving me the file name now.. how do i check this inside the script ftp -vpd $HOST << END_SCRIPT ls "$filename" if [ $? -eq 0 ]; then echo "file exists: "$filename" " else echo "file doesn't exists fi END_SCRIPT red lines execute kavadam ledhu.. bye1
The_Joker Posted January 5, 2015 Report Posted January 5, 2015 sftp user@host Password CD to the directory find . -name "<regex>" Akkada regex lo filename ivochu Match ayithe vasthado Ledhante dobbamantadi This is as far I know
chinni005 Posted January 5, 2015 Author Report Posted January 5, 2015 ftp -vpd $HOST : to connect to remote server ls $filename : gives me if the file exists now how i check this condition in if loop if[ls $filename];then do something else do nothing please help me with if condition
sigsegv Posted January 5, 2015 Report Posted January 5, 2015 ftp -vpd $HOST : to connect to remote server ls $filename : gives me if the file exists now how i check this condition in if loop if[ls $filename];then do something else do nothing please help me with if condition status code chesk cheyyi .. ls $filename if $? -eq 0 ;then do something else do nothing
chinni005 Posted January 5, 2015 Author Report Posted January 5, 2015 status code chesk cheyyi .. ls $filename if $? -eq 0 ;then do something else do nothing ftp -vpd $HOST << END_SCRIPT ls "$filename" if [ $? -eq 0 ]; then echo "file exists: "$filename" " else echo "file doesn't exists fi END_SCRIPT red lines execute kavadam ledhu.. invalid command antundhi... bye1
sigsegv Posted January 5, 2015 Report Posted January 5, 2015 ftp -vpd $HOST << END_SCRIPT ls "$filename" if [ $? -eq 0 ]; then echo "file exists: "$filename" " else echo "file doesn't exists fi END_SCRIPT red lines execute kavadam ledhu.. invalid command antundhi... bye1 bash ??
Recommended Posts