deleting multiple files through ftp | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

deleting multiple files through ftp

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 04-11-2006
mgirinath mgirinath is offline
Registered User
 
Join Date: May 2005
Last Activity: 3 November 2008, 2:18 PM EST
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
deleting multiple files through ftp

Hi,

I have a situation where I need to delete multiple files from a folder once I connect to FTP server. I am using ftp script to get the files, number of files always vary from 1 to 100. once I get the files I need to delete all the files downloaded I am making a list of all the files downloaded and store in a variable so at the end when I am ready to delete files my variable will have all the names of files to be deleted like....
VAR_FILES_DELETE=file1 file2 file3 file4 file4

I am using a command del ${VAR_FILES_DELETE} this is not working it is just deleting file1 why is it not deleting all the files...?
or is it a limitation that we can delete only one file at a time...?

is there any other way to delete multiple files once I get connected to FTP...?

Please help.

Thanks,
Sponsored Links
    #2  
Old 04-11-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 19 September 2014, 10:01 PM EDT
Location: NM
Posts: 10,211
Thanks: 278
Thanked 796 Times in 743 Posts
you can use a wildcard and mdelete or mdel:

Code:
ftp -i -n <<EOF
open whatever
user user pass
mdelete /path/to/files/*.log
EOF

Sponsored Links
    #3  
Old 04-12-2006
mgirinath mgirinath is offline
Registered User
 
Join Date: May 2005
Last Activity: 3 November 2008, 2:18 PM EST
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for reply but, I do not want to delete all the files that are there but only list of files and there are different extensions files....
    #4  
Old 04-12-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 19 September 2014, 10:01 PM EDT
Location: NM
Posts: 10,211
Thanks: 278
Thanked 796 Times in 743 Posts

Code:
echo "
 open nodename
 user me pass
 cd /path/to/files
"       > ftp_$$.tmp
while read file
do 
    echo "delete $file"
done < list_of_files >> ftp_$$.tmp

echo "
 bye
 " >> ftp_$$.tmp

ftp -n < ftp_$$.tmp

Sponsored Links
    #5  
Old 04-18-2006
mgirinath mgirinath is offline
Registered User
 
Join Date: May 2005
Last Activity: 3 November 2008, 2:18 PM EST
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
That worked thanks
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
problem deleting multiple files using rm in UNIX bquattrone UNIX for Dummies Questions & Answers 1 10-06-2011 05:32 PM
Deleting Multiple Files With the Same Content Boris_yo UNIX for Dummies Questions & Answers 10 02-20-2010 11:19 PM
Deleting a column in multiple files that are comma separated Lucky Ali Shell Programming and Scripting 9 11-01-2009 04:34 PM
deleting lines from multiple text files vrms Shell Programming and Scripting 3 04-25-2008 11:01 AM
Deleting Multiple Lines with sed rambo15 Shell Programming and Scripting 1 02-16-2002 05:19 PM



All times are GMT -4. The time now is 11:57 AM.