Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP all files except for the filenames specified

Status
Not open for further replies.

FoxHu

Programmer
Jul 23, 2003
2
0
0
US
I want to FTP all files from a folder except for the ones whose name are specified.
I am using Mget *.* to FTP all files. I think I just need to modify the Mget Command to include some parameter.

Can somebody please help me. Help Appreciated.
 
Run a job like this either locally or remotely depending on which way the ftp is going. It may not work exactly as written, but it's how I would approach it.

#!/bin/sh
# get single column list of files to exclude
echo $@ | tr " " "\012" > ../exception.lst
tar -cf ../tmp.tar exception.lst .

then ftp the .tar file, then untar it. In one of the other posts a while back someone wrote how to use ftp in a script, but I forgot which one.

You could also use 'find . -type -f -print | fgrep -v -f exception.lst > include.lst', then 'tar -cf tmp.tar `cat include.lst`'

Note there's a limit to how many entries 'fgrep -f' can handle. I forget what it is. (Like 255 or something.)

Sean aka TimeTraveler



Visit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top