I am having SFTP server from which I am supposed to poll files. I have writtten a shell script to get the files from the SFTP location and had this OS level command called from XI adapter.
So the shell script first gets the file from SFTP server (since XI at present doesn't support SFTP) and then adapter will poll the same.
My problem is once i am done with my SFTP get i should be able to rename the files. But it seems rename can only rename one file at a time and can't rename multiple files at a time. i tried to use wild card characters but its of no use.
had anyone done renaming multiple files at a time on the FTP server? i was trying to use ls to get hte list of files and then loop on it but don't know how to do the same.
Thanks in advance.
Hi Rajeev !
Maybe an idea could be within a script, launch an ls to gather the list of filenames in a file using ">" or ">>". Then process that file using loops and parse it to detect the filenames and create a new ftp script on the fly that makes the "rename $1 $2" for each file of the previously populated list, like
cat file.lst |while read line; do echo "rename $ $.old" >> new_ftp_script.sh; done
/tmp/file with space.txt
then execute that script that will login again to the ftp, and send the proper rename commands.
check this blog ,https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/7036s [original link is broken] [original link is broken] [original link is broken]