Results 1 to 1 of 1
I am programming a script that is downloading video files, processing them, and then uploading them again to an FTP server. I have been using wget and wput for this ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-20-2010 #1
- Join Date
- Oct 2010
mget / mput filename conversion and other issues
I have been using wget and wput for this purpose, and they give me important features such as invalid character conversion in file names, not downloading files with certain endings etc.
These are the commands I use:
wget --timestamping --restrict-file-names=ascii --reject=pdf,jpg,mp3,html,htm,log,php,wav,jpeg,gif,p ng,tiff,tif,psd,pic,pnt,raw,pct,txt,doc,xls --output-file=$log_dir/ftp-download-$NOW.log --directory-prefix=$path/$username/ftp-download-$NOW -nH -np ...
wput --timestamping --basename=$path/$username/ --output-file=$log_dir/ftp-upload-$NOW.log $path/$username/fertigeVideos/$1 ...
[ending the commands with ... because of the error "You are only allowed to post URLs to other sites after you have made 15 posts or more."]
Now, the thing is that I need to not only upload/download files, but move files around within the FTP server directories after each wget / wput operation, create new remote directories etc. Currently, I would have to open a new ftp session after the wget / wput downloads, which costs extra time. I would rather do both up/downloading and remote file operations in one single ftp session each time. For that, an automated ftp session would work, such as:
ftp -in $hostname <<EOF
quote USER $username
quote PASS $password
BUT, the problem is that the mget / mput commands are much less powerful than wget / wput. How could I achieve the file name conversion to ascii characters only, or the reject option (which is important because I want to process ALL files except certain endings, and not the other way round of just copying files with certain endings)? I also need to process the outcome of the file transfers through error codes, and I'm not sure that mget / mput can provide such error codes.
Your suggestions are greatly appreciated!