Creating a list of files retrieved from MGET

Is there a way to create a txt file with the names of the files I retreive using mget *.file. I want to use this file as input to a delete command.

Using HP-UX

Yes, use the ls or dir commands from a ftp session first and save the output for further processing.

Apart from being able to deduce that this is a question about the unix ftp command from the mention of mget there is no mention of any environmental details like Operating Systems, Shells or other useful details.

Let's see your attempt first.

Assumption here is you are using a .netrc file for login and password and that filenames don't have space.

Now just do ls *.file and then use this a input to build your get and del commands:

file_list=$(ftp your_host <<EOF
cd /your/dir
ls *.file
quit
EOF)
 
cmd=$(echo $file_list | awk 'length{printf "get %s\ndel %s\n", $1, $1}' RS=" ")
 
ftp your_host <<EOF
cd /your/dir
$cmd
quit
EOF

Edit: @Methyl - Great minds think alike

Will try this. Thanks for the info.