Read Files from a Directory


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Read Files from a Directory
# 1  
Old 04-17-2008
Read Files from a Directory

Hi,
I have a requirement where I have get the files from FTP server then delete the files in the FTP server and then store the file name within the file where there is "TR".
i.e
Filename|TR|20071231|....

Once I finish loading my file I have to archive the files.

Is there any way to do it in Unix scripting?

Thanks in advance
Kiran
# 2  
Old 04-18-2008
Sounds like it's doable, but your requirements are not very clear.

Local directory which just happens to belong to the FTP server, or files on a remote FTP server?

All files in that particular directory?

Archive and create a report file with the file name, a TR, and the date of ... the file's last modification time?

Archive how? Move to another directory, or create a tar file in the current directory, or move to a remote host?
# 3  
Old 04-18-2008
Hi there,
Sorry for not being clear in my original post. I will write it down in steps
1) Ftp pull the files starting with P*. i.e pull alll the files with P*.
2) Once the files have been pulled, delete the files from the FTP server.
3) The file will have TR and LN records embedded in one file. I think you have solved my problem of seperating TR and LN. TR is the header record. I have to assign the file name to the TR. Preferably at the end of the line. The records are PIPE delimitted.
4) Process the files and archieve it in the local directory. Thats different directory than the current directory and zip the archieve files.

Thats it

Thanks in advance
Kiran
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How do i read only last 5 files records from a directory.?

Hello team, I have a directory containing huge number of files. I need to go select last 5 files and read it to do a calculation. Kindly guide, how can i achieve it. Regards, Sadique (13 Replies)
Discussion started by: sadique.manzar
13 Replies

2. Shell Programming and Scripting

Directory containing files,Print names of the files in the directory that are exactly same content.

Given a directory containing say a few thousand files, please output a list of all the names of the files in the directory that are exactly the same, i.e. have the same contents. func(a_directory_name) output -> {“matches”: , ... ]} e.g. func(“/home/my/files”) where the directory... (7 Replies)
Discussion started by: anuragpgtgerman
7 Replies

3. Shell Programming and Scripting

List files with date, create directory, move to the created directory

Hi all, i have a folder, with tons of files containing as following, on /my/folder/jobs/ some_name_2016-01-17-22-38-58_some name_0_0.zip.done some_name_2016-01-17-22-40-30_some name_0_0.zip.done some_name_2016-01-17-22-48-50_some name_0_0.zip.done and these can be lots of similar files,... (6 Replies)
Discussion started by: charli1
6 Replies

4. UNIX for Dummies Questions & Answers

Read all files in a directory for a unix command

Hello, Below, I have a unix command, which can be executable for single file. cat input.txt | sort -k3,3 > output.txt I have 100 input files in a directory. It is hectic and time taking to run the above command for all the 100 files for 100 times. Now, I want to execute the above unix... (2 Replies)
Discussion started by: koneru_18
2 Replies

5. Shell Programming and Scripting

How to read and append certain files form directory

Hi ,i have a question ,if I am in sertain directory and I have 4 files *.c how can I read and append this files in file backup.bac Thanks find ./ -name "*.csh" | wc -l (2 Replies)
Discussion started by: lio123
2 Replies

6. UNIX for Dummies Questions & Answers

Read directory files and count number of lines

Hello, I'm trying to create a BASH file that can read all the files in my working directory and tell me how many words and lines are in that file. I wrote the following code: FILES="*" for f in "$FILES" do echo -e `wc -l -w $f` done My issue is that my file is outputting in one... (4 Replies)
Discussion started by: jl487
4 Replies

7. UNIX for Advanced & Expert Users

read() wont allow me to read files larger than 2 gig (on a 64bit)

Hi the following c-code utilizing the 'read()' man 2 read method cant read in files larger that 2gig. Hi I've found a strange problem on ubuntu64bit, that limits the data you are allowed to allocate on a 64bit platform using the c function 'read()' The following program wont allow to allocate... (14 Replies)
Discussion started by: monkeyking
14 Replies

8. UNIX for Dummies Questions & Answers

Using Awk within awk to read all files in directory

I am wondering if anyone has any idea how to use an awk within awk to read files and find a match which adds to count. Say I am searching how many times the word crap appears in each files within a directory. How would i do that from the command prompt ... thanks (6 Replies)
Discussion started by: flevongo
6 Replies

9. Shell Programming and Scripting

read files from directory

hi i have a directory /tmp/Satya,it contains 5.FILE 6.FILE 7.FILE i need to read each file , and read its content line by line please help thanks Satya (2 Replies)
Discussion started by: Satyak
2 Replies

10. Shell Programming and Scripting

Read from fileList.txt, copy files from directory tree

Hi, hopefully this is a fairly simple Q&A. I have a clean file list of approximately 180 filenames with no directory or slashes in front of the filename nor any extension or dot ".". I would like to read from this list, find these files recursively down through directory trees, copy the files... (1 Reply)
Discussion started by: fxvisions
1 Replies
Login or Register to Ask a Question