Sponsored Content
Top Forums Shell Programming and Scripting deleting multiple files through ftp Post 302071137 by jim mcnamara on Wednesday 12th of April 2006 03:13:01 PM
Old 04-12-2006
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

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to send multiple files during ftp

Hi guys... I'm working on #!/bin/sh script in a Solaris 7 box that should send several files over to another machine via FTP. Here's what the script looks like: # This script will send the daily MSP customer counts # to the Crystal Reports server located at 192.168.2.106 cd... (2 Replies)
Discussion started by: cdunavent
2 Replies

2. HP-UX

how to ftp multiple files

Hi, I have to write a ftp script which transfers multiple files from one unix server to another. When I try to transfer single file it goes through successfully. But, When I try to do multiple files none of the files get ftp'd. And also, even the single file goes transferred successfully, I... (4 Replies)
Discussion started by: isingh786
4 Replies

3. Shell Programming and Scripting

deleting lines from multiple text files

I have a directory full of text data files. Unfortunately I need to get rid of the 7th and 8th line from them all so that I can input them into a GIS application. I've used an awk script to do one at a time but due to the sheer number of files I need some kind of loop mechanism to automate... (3 Replies)
Discussion started by: vrms
3 Replies

4. Shell Programming and Scripting

Need help in deleting old files from a ftp server

Hi, I'm quite new to unix and perl scripting and need to write a script to delete files older than 7 days from a remote ftp server. Unix or Perl script would do... I wrote the following code: #!/usr/local/bin/perl use File::Basename; use Net::FTP; #use Net::FTP::File; my $verbose =... (15 Replies)
Discussion started by: arunsoman80
15 Replies

5. Shell Programming and Scripting

Deleting a column in multiple files that are comma separated

Hi, I have a directory that contains say 100 files named sequencially like input_1.25_50_C1.txt input_1.25_50_C2.txt input_1.25_50_C3.txt input_1.25_50_C4.txt .. .. .. input_1.25_50_C100.txt an example of the content in each of the file is: "NAME" "MEM.SHIP" "cgd1_10" "cgd1_10"... (9 Replies)
Discussion started by: Lucky Ali
9 Replies

6. UNIX for Dummies Questions & Answers

Deleting Multiple Files With the Same Content

My website has been hacked and i need to remove a lot of unique files with same content. The files have very similar code: eval(base64_decodeHow do i find multiple/all the files with the above code and remove them? Thanks. (10 Replies)
Discussion started by: Boris_yo
10 Replies

7. Shell Programming and Scripting

FTP multiple files from multiple directories

I have multiple files that starts as TRADE_LOG spread across multiple folders in the given structure.. ./dir1/1/TRADE_LOG*.gz ./dir2/10/TRADE_LOG*.gz ./dir11/12/TRADE_LOG*.gz ./dir12/13/TRADE_LOG*.gz when I do ftp uisng mput from the "." dir I am getting the below given error mput... (1 Reply)
Discussion started by: prasperl
1 Replies

8. UNIX for Dummies Questions & Answers

problem deleting multiple files using rm in UNIX

I'm baffled..... the system I work on creates files every Mon-Friday I'm trying to delete all files older than 30 days old from a Unix prompt, the command I'm using is: find /directory/ -mtime +30 -exec rm {} \; however it returns /directory/filename: 644 mode ? (y/n) for every file! ... (1 Reply)
Discussion started by: bquattrone
1 Replies

9. Shell Programming and Scripting

Transfer multiple different files in FTP

Hi All, i am doing ftp how can i transfer multiple different files example- 03-21-13 06:33AM 46800 CATT_HOURS.pgp 03-21-13 06:33AM 266392 CATT_TAX.txt 03-21-13 06:33AM 91448 CATT_STATUS.txt 03-21-13 06:33AM 468 ... (3 Replies)
Discussion started by: krupasindhu18
3 Replies

10. Shell Programming and Scripting

Deleting multiple files off an ftp server once they have been downloaded

Hello, I have a server that I have to ftp files off and they all start SGRD and are followed by 6 numbers. SGRD000001 SGRD000002 SGRD000003 The script I have will run every 10 mins to pick up files as new ones will be coming in all the time and what I want to do is delete the files I have... (7 Replies)
Discussion started by: sph90457
7 Replies
FTP-UPLOAD(1p)						User Contributed Perl Documentation					    FTP-UPLOAD(1p)

NAME
ftp-upload - batch transfer local files to an FTP server SYNOPSIS
ftp-upload [any-switch]... {[repeatable-switch]... file...}... DESCRIPTION
ftp-upload is used to send local files to an FTP server. It isn't interactive, it's meant to be used from scripts. It is disciplined about its exit value and it doesn't output informational messages by default. There are two kinds of switches. Initial switches have to appear before any filenames, they affect the session as a whole. Repeatable switches can appear interspersed with the file names, they affect the transfer of the files which appear after them on the command line. OPTIONS
Initial switches These have to be used before any file names listed on the command line. --debug Turn debugging on. --help Show the usage message and die. --ignore-quit-failure Don't complain or set a failure exit code just because the QUIT command fails. This can be necessary because some servers, in blatant disregard of RFC 959, close the command channel when you send them an ABOR command. -v, --verbose Print informational messages to stdout. --version Show the version number and exit. Initial switches which specify connection information These also have to be used before any file names listed on the command line. They specify the information used to set up the FTP connec- tion. --account account This specifies the account to be used when logging into the remote system. This is distinct from the user name used to log in. Few systems need this. There is no default. -h, --host host Specify the host to which to connect. There is no default, you have to specify this switch. --passive Force the use of passive (PASV) transfers. Passive transfers are required with some firewall configurations, but if you have such you'd do better to configure Net::FTP so that it knows when to use them (see Net::Config). If you need to use passive transfers with certain (broken) servers, however, this switch is your best bet. Alternatively, you can set $FTP_PASSIVE to 1 in the environment (see Net::FTP). --password pw This gives the password which will be used to login. The default is your email address. Note that you should not specify a real (secret) password this way, as on most systems anybody on the machine can see the arguments you pass to your commands. Use one of other password-setting switches instead. -s, --password-stdin This tells ftp-upload to read the password from standard input. No prompt will be printed, and a single line will be read. Most peo- ple will use this switch to specify the password. Eg, echo 3x9sjJJh | ftp-upload -sh $host -u $user $file Using echo this way is safe where the --password switch isn't if the echo command is built in to the shell. --password-fd fd This is like --password-stdin except that it reads the password from the file descriptor numbered fd. ftp-upload -h $host -u $user --password-fd=3 3<$pw_file $file -u, --user user Specify the user name to use when logging in. The default is "anonymous". Repeatable switches These switches can be used anywhere on the command line (except after the last file name). They affect the transfer of files listed after them. --as remote-name Normally a file is transferred using the same name it has locally. If you use this switch the next file transferred will be called remote-name on the other host instead. ftp-upload --host $host --as index.htm index.html -a, --ascii Perform transfers in ASCII mode. -b, --binary Perform transfers in binary mode. This is the default. -d, --dir dir Change directory to dir on the FTP server before continuing. You can use this multiple times between files, ftp-upload will chdir once for each time you specify it. Using ".." as the dir will cause an FTP "CDUP" to be done rather than a "CWD". --full-path Normally uploaded files go into the current directory on the remote host, even when the local file name given contains slashes. Eg, if you say ftp-upload -h $host /etc/motd ftp-upload will upload the file as motd, not /etc/motd. This differs from how the standard ftp program works, and it also differs with how ftp-upload worked before version 1.3. If you specify --full-path, you'll get the other behavior. A request to upload dir/file will tell the server to store dir/file rather than file. When you use --as the --full-path setting doesn't matter. --full-path only tells the program what name to use when it's choosing the name. --no-full-path Disable --full-path. This is the default. -l, --ls Try to get a remote directory listing of files after transferring them. I say "try" because there's no guaranteed way to do this with the FTP protocol. The command I run is "LIST file". This will generally work if file doesn't contain any special characters. -L, --no-ls Disable the --ls behavior. --tmp-none Transfer files directly, don't do anything special to try to ensure that they don't appear under their real names on the remote machine until the transfer is finished. Each file is transferred with a single simple "STOR". This is the default. --tmp-samedir Transfer files to the remote machine using a temporary name, then rename them when the transfer finishes. This won't work if the remote server doesn't give a recognizable response to the "STOU" command. If the server's response to "STOU" isn't recognized by Net::FTP but is reasonable, Graham Barr might be willing to change Net::FTP to recognize it. If you like you can send the "--debug" output to me and I'll coordinate such requests. --tmp-dir dir Transfer files to dir on the remote host, then rename them when the transfer is complete. This is safer than --tmp-samedir because it doesn't use "STOU" and so it works with more servers. ftp-upload -h $host --tmp-dir incoming $file --tmp-format fmt Transfer files to "sprintf(fmt, file base name)", then rename them when the transfer is complete. Like --tmp-dir, this is safer than --tmp-samedir because it doesn't use "STOU" and so it works with more servers. ftp-upload -h $host --tmp-format tmp.%s $file AUTHOR
Roderick Schertler <roderick@argon.org> perl v5.8.7 2006-03-16 FTP-UPLOAD(1p)
All times are GMT -4. The time now is 09:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy