Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Delete files whose file names are listed in a .txt file Post 302752343 by Yoda on Monday 7th of January 2013 12:03:16 AM
Old 01-07-2013
It is difficult to tell what exactly is the error without seeing your code. By the way I see you are using a while loop to read file-name and opening FTP connection for each file. I suggest using an awk code to get all the file transferred in single connection:-
Code:
awk 'BEGIN {
 print "ftp -i -n << EOF"
 print "open 192.168.1.75"
 print "user loguser PASSWORD"
 print "prompt"
 print "cd \logs_finacle"
} {
 print "put "$0 
}
END {
 print "EOF"
}' /usr/ftprm.txt > ftp_batch

chmod +x ftp_batch

./ftp_batch

This User Gave Thanks to Yoda For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How can I delete files using a file that containt path and names?

Recentily i receive virus ninda and my network was files *.eml. I find all *.eml with: find / -name *.eml -print > virus Virus has the path and name of the file,so, How can i delete all *.eml? Thanks (2 Replies)
Discussion started by: AlvaroD
2 Replies

2. Shell Programming and Scripting

[Urgent]how to print the file names into a txt file???

HI, I have a folder with some 120 files...i just want to print all the file filenames(not the content or anything else) onto a file say .txt. please help me with this command Thanks a lot. (15 Replies)
Discussion started by: kumarsaravana_s
15 Replies

3. UNIX for Dummies Questions & Answers

recursive delete files from txt file or?

i have a txt file of image names that have to be deleted in pwd how can i use the txt file to delete the files in pwd and is it possible?--i might be able to import the txt files into a spreadsheet ahd same it as a csv file. i want it to be done recursive lly --what i mean is teh sysem goes thru... (4 Replies)
Discussion started by: plener
4 Replies

4. Shell Programming and Scripting

Finding consecutive numbers in version names on a txt file

Hi all. I have a directory which contains files that can be versioned. All the files are named according to a pattern like this: TEXTSTRING1-001.EXTENSION TEXTSTRING2-001.EXTENSION TEXTSTRING3-001.EXTENSION ... TEXTSTRINGn-001.EXTENSION If a file is versioned, a file called ... (10 Replies)
Discussion started by: fox1212
10 Replies

5. Shell Programming and Scripting

Copy files listed in text file to new directory

I am trying to write a script that will copy all file listed in a text file (100s of file names) to a new directory Assume script will run with main as current working directory and I know how many files/lines will be in List.txt Im trying to work up a test script using this model Contents of... (2 Replies)
Discussion started by: IAmTheGrass
2 Replies

6. Shell Programming and Scripting

Exclude certain file names while selectingData files coming in different names in a file name called

Data files coming in different names in a file name called process.txt. 1. shipments_yyyymmdd.gz 2 Order_yyyymmdd.gz 3. Invoice_yyyymmdd.gz 4. globalorder_yyyymmdd.gz The process needs to discard all the below files and only process two of the 4 file names available ... (1 Reply)
Discussion started by: dsravanam
1 Replies

7. Shell Programming and Scripting

Delete files listed in text file

Hi Team, Here's the scenario, I have a text file called "file_list.txt". Its content is as follows. 111.tmp 112.tmp 113.tmp 114.tmp These files will present in "workdir" directory. It has many files. But only the files present in file_list.txt has to be deleted from the workdir... (7 Replies)
Discussion started by: kmanivan82
7 Replies

8. Shell Programming and Scripting

Want to delete the junk files from a directory which are not listed in a TEXT file

Hello Everyone, I want to delete the image files from a directory, which are not listed in a TEXT file. The directory contains large number of image files (in millions) required / not required. I want to delete the image files which are "not required". I have generated a Text file having... (3 Replies)
Discussion started by: Praveen Pandit
3 Replies

9. UNIX for Dummies Questions & Answers

Delete files in a txt file

Hi, I have very old files in my server like from 2012 and i want to delete them, Please help. Thanks in advance.. (2 Replies)
Discussion started by: nanz143
2 Replies

10. Shell Programming and Scripting

Delete files except the file names available in the Except File

Hi, I need some help in the below scenario. I need to delete all the files from the directory except the file name available in the Except file. Like the folder ABC have files like A1.txt,A2.txt......A10.txt and also have a file named Except.txt with the content A3.txt,A4.txt Need a... (6 Replies)
Discussion started by: kban
6 Replies
ct_ftp(3erl)						     Erlang Module Definition						      ct_ftp(3erl)

NAME
ct_ftp - FTP client module (based on the FTP support of the INETS application). DESCRIPTION
FTP client module (based on the FTP support of the INETS application). DATA TYPES
connection() = handle() | target_name() (see module ct) : handle() = handle() (see module ct_gen_conn) : Handle for a specific ftp connection. EXPORTS
cd(Connection, Dir) -> ok | {error, Reason} Types Connection = connection() Dir = string() Change directory on remote host. close(Connection) -> ok | {error, Reason} Types Connection = connection() Close the FTP connection. delete(Connection, File) -> ok | {error, Reason} Types Connection = connection() File = string() Delete a file on remote host get(KeyOrName, RemoteFile, LocalFile) -> ok | {error, Reason} Types KeyOrName = Key | Name Key = atom() Name = target_name() (see module ct) RemoteFile = string() LocalFile = string() Open a ftp connection and fetch a file from the remote host. RemoteFile and LocalFile must be absolute paths. The config file must be as for put/3. See also: put/3 . ls(Connection, Dir) -> {ok, Listing} | {error, Reason} Types Connection = connection() Dir = string() Listing = string() List the directory Dir. open(KeyOrName) -> {ok, Handle} | {error, Reason} Types KeyOrName = Key | Name Key = atom() Name = target_name() (see module ct) Handle = handle() Open an FTP connection to the specified node. You can open one connection for a particular Name and use the same name as reference for all subsequent operations. If you want the connection to be associated with Handle instead (in case you need to open multiple connections to a host for example), simply use Key , the configuration variable name, to specify the target. Note that a connection that has no associated target name can only be closed with the handle value. put(KeyOrName, LocalFile, RemoteFile) -> ok | {error, Reason} Types KeyOrName = Key | Name Key = atom() Name = target_name() (see module ct) LocalFile = string() RemoteFile = string() Open a ftp connection and send a file to the remote host. LocalFile and RemoteFile must be absolute paths. If the target host is a "special" node, the ftp address must be specified in the config file like this: {node,[{ftp,IpAddr}]}. If the target host is something else, e.g. a unix host, the config file must also include the username and password (both strings): {unix,[{ftp,IpAddr}, {username,Username}, {password,Password}]}. recv(Connection, RemoteFile) -> ok | {error, Reason} Fetch a file over FTP. The file will get the same name on the local host. See also: recv/3 . recv(Connection, RemoteFile, LocalFile) -> ok | {error, Reason} Types Connection = connection() RemoteFile = string() LocalFile = string() Fetch a file over FTP. The file will be named LocalFile on the local host. send(Connection, LocalFile) -> ok | {error, Reason} Send a file over FTP. The file will get the same name on the remote host. See also: send/3 . send(Connection, LocalFile, RemoteFile) -> ok | {error, Reason} Types Connection = connection() LocalFile = string() RemoteFile = string() Send a file over FTP. The file will be named RemoteFile on the remote host. type(Connection, Type) -> ok | {error, Reason} Types Connection = connection() Type = ascii | binary Change file transfer type AUTHORS
<> common_test 1.5.3 ct_ftp(3erl)
All times are GMT -4. The time now is 08:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy