Wput script
Hi,
I created a script to upload a file to my ftp server once week. The problem is that the file name changes every day. is there a way I could setup this script to copy *.123 instead of specifying a file name? script: echo off echo Backing up your data offsite, please wait... cd \ cd folder cd backup wput -v *.123 ftp://ftpuser:password@ftpserver/ftpfolder/ I tried this script but it did not find the file above *.123. Thank you! |
Why not replace the last line with the following:
for FILE in *.123; do wput -v $FILE ftp://ftpuserassword@ftpserver/ftpfolder/ done |
Before I go fully answering this, what type of script is this? I ask because I see the "echo off" above, and it reminds me of windows.... Also, what shell are you using? Normally in linux, this would work. A quick solution off the top of my head, in linux, would be to list all files with that extension, and pipe to a new file, then use the -i argument with wput, a such:
Code:
cd /folder/backup |
ricstirato, I will try that. Thanks for your response.
corp769: Yes, it is a W$ndows machine. It is a DOS batch file. Thanks |
Well then that explains it. Why would you post a windows type question in a linux forum? Reporting this thread to be moved... Sorry to come off as a dick, but seriously, these are linux forums...... Hope you understand! And by the way.... I don't use windows at all, let-alone script batch files anymore. Sorry I can't help you, but I can not emulate what you are trying to do, since I don't have windows installed on any of my computers.
Cheers, Josh |
Josh,
The reason why I posted it is because I am using 'wput' which I believe is an Open Source program that comes for Linux and W$ndows. Also, the FTP where the file is being uploaded to is a Ubuntu LTS server running vsftpd server. If I go to a W$ndows forum, I am sure they will direct me to a 'paid FTP program' to be able to accomplish what I want to do. I wish I could get rid of W$ndows but there are many applications that need to be run under W$ndows. |
In that case, the easiest way to take advantage of solns above that use Linux shell is to install Cygwin on your MS system.
This gives you a *nix style interface (in addition to whatever is there already), so that you can use most shell cmds and other *nix tools. |
Thank you Chrism! I will try that. I appreciate your help. Cheers!
|
Hi ceantuco
there is a way if using command line FTP client - LFTP (install Cygwin and when installing packages check LFTP) and then you can use command "mput": Code:
mput Code:
lftp -c "open $HOST && user $USER $PASSWD && cd FOLDER_NAME_FOR_STORING/backups/ && mput $FILE" - $HOST is your ftp address - $USER $PASSWD - self explanatory - $FILE - filename / names pattern like: lftp -c "open mysiteftp.net && user ftpuser ftppassword && cd /home/ftpuser/backups && mput *.123" |
All times are GMT -5. The time now is 07:57 AM. |