Recursive file processing


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Special Forums Hardware Filesystems, Disks and Memory Recursive file processing
# 1  
Java Recursive file processing

I'm developing a generic script to catenate all files found in a given directory.
The problem I've got is that the depth of the given directory is unknown, so I end up with some catenated directories. My unix isn't that hot and I'm at a loss.
Heres an extract from the script

cd $1
for i in `find * -type d`
do
cd $i
for files in `find * -type f`
do
cat ${files} >> ${i}.ddl
done
done
~

Smilie
# 2  
This is untested, but is probably very close.
Code:
cd $1
for i in `find . -type d`
do
      ( cd $i ; for files in `find . ! -name . -prune -type f` ; do
              cat ${files} >> ${i}.ddl
        done  )
done

# 3  
Thanks Perderabo.
This didn't solve the problem but did provide alternate solutions.
# 4  
recursive concat

How did you solve this finally? Can you provide the code?
# 5  
ajitkt,

This is a thread of 2 years old, I don't think the OP will notice your question.
If you have any question, start a new thread, explain what you have so far, and what you're having trouble with.

Regards
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #836
Difficulty: Medium
SOAP is a data serialization specification.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Recursive delete in a file using a set of values in other file

Hi, I have got a file with 6K records and I want to delete 500 records from this file which match the values present in another file. Format of the both the files is different. Example : File 1 record CCCCCC 11292562ABCDEF MBR/PSF6/108100502/BEN01XXX XXX Example : File 2 record... (1 Reply)
Discussion started by: Nikhath
1 Replies

2. Programming

awk processing / Shell Script Processing to remove columns text file

Hello, I extracted a list of files in a directory with the command ls . However this is not my computer, so the ls functionality has been revamped so that it gives the filesizes in front like this : This is the output of ls command : I stored the output in a file filelist 1.1M... (5 Replies)
Discussion started by: ajayram
5 Replies

3. UNIX for Dummies Questions & Answers

Recursive Find on file size

Is there a way to use the find command to recursively scan directories for files greater than 1Gb in size and print out the directory path and file name only? Thanks in advance. (6 Replies)
Discussion started by: jimbojames
6 Replies

4. Shell Programming and Scripting

Recursive file processing from a path and printing output in a file

Hi All, The script below read the path and searches for the directories/subdirectories and for the files. If files are found in the sub directories then read the content of the all files and put the content in csv(comma delimted) format and the call the write to xml function to write the std... (1 Reply)
Discussion started by: Optimus81
1 Replies

5. UNIX for Dummies Questions & Answers

Recursive file organization?

Does anyone have any idea of how I can make something like the code below run recursively? I'll run it on a tree of directories all with different names and all containing a sequence of .dpx files. I've tried to do it using find and exec but can't get it to work right. What it needs to do is... (4 Replies)
Discussion started by: scribling
4 Replies

6. Shell Programming and Scripting

Recursive List File Permissions

How can I recursively list file permission including all subdirectories and save the result to a file. I also want to exclude certain file type such as *.log. All I need is the UID and GID of each of the files/folders output to a text file. Any ideas, any help very much apperciated. (1 Reply)
Discussion started by: kelseyh
1 Replies

7. Shell Programming and Scripting

Recursive List File Permissions

How can I recursively list file permission including all subdirectories and save the result to a file. I also want to exclude certain file type. All I need is the UID and GID of each of the files. (1 Reply)
Discussion started by: kelseyh
1 Replies

8. Red Hat

filtering the recursive ids in a file

i have a file which contains the data as below, 789990 789990 789990 789990 334989 334989 789990 -- here the no 789990 is repeated 5 times and 334989 is 2 times. i want the output to be, 789990 334989 i.e only one entry of the repeated nos. (4 Replies)
Discussion started by: saravanen
4 Replies

9. UNIX for Dummies Questions & Answers

Renaming file in Recursive folders

I have UWin version of Unix for Destop I have files with extension *.abc. I want to rename it to *.csv. Some of the filenames have spaces. I also to rename the files with extension *.abc in the corresponding subfolders ex == abc def.abc ghi jkl.abc mnopqr.abc uvwxyz.abc rename as... (4 Replies)
Discussion started by: bobbygsk
4 Replies

10. UNIX for Dummies Questions & Answers

extracting recursive data file

Hi Gurus, Can awk be able to do this source file: 1|SPFE2027G1|1PFE-7000|T34801188|5066-0844| 2|T34801188|5066-0844|T35002355|5066-0845| 3|T35002355|5066-0845|T35203409|QFBR-7798| 1|SPFE2027H1|1PFE-7000|T34801198|5066-0844| 2|T34801198|5066-0844|T35002365|5066-0845| formatted into:... (1 Reply)
Discussion started by: bbeugie
1 Replies

Featured Tech Videos