The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Adding Multiple Lines to Multiple Files dayinthelife Shell Programming and Scripting 2 06-04-2008 11:50 AM
deleting lines from multiple text files vrms Shell Programming and Scripting 3 04-25-2008 11:01 AM
deleting multiple records from a huge file at one time dsravan Shell Programming and Scripting 5 02-06-2008 11:17 AM
Searching multiple files with multiple expressions Anahka Shell Programming and Scripting 6 01-07-2004 06:24 PM
Deleting Multiple Lines with sed rambo15 Shell Programming and Scripting 1 02-16-2002 06:19 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-11-2006
mgirinath mgirinath is offline
Registered User
  
 

Join Date: May 2005
Posts: 69
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,
  #2 (permalink)  
Old 04-11-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
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
  #3 (permalink)  
Old 04-12-2006
mgirinath mgirinath is offline
Registered User
  
 

Join Date: May 2005
Posts: 69
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 (permalink)  
Old 04-12-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
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
  #5 (permalink)  
Old 04-18-2006
mgirinath mgirinath is offline
Registered User
  
 

Join Date: May 2005
Posts: 69
That worked thanks
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:41 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0