Recursive file processing


 
Thread Tools Search this Thread
Special Forums Hardware Filesystems, Disks and Memory Recursive file processing
# 1  
Old 05-22-2006
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  
Old 05-22-2006
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  
Old 05-23-2006
Thanks Perderabo.
This didn't solve the problem but did provide alternate solutions.
# 4  
Old 03-24-2008
recursive concat

How did you solve this finally? Can you provide the code?
# 5  
Old 03-24-2008
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 to Ask a Question

Previous Thread | Next Thread

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. 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

9. UNIX for Dummies Questions & Answers

Selective, recursive file diddling!

Hello, I have been trying all sorts of combinations and been royally screwing up my filesystem in the process :rolleyes: I have a bunch of .wav files in a hierarchical album/artist etc folder structure and each has a duplicate .w4a file next to it. All I want to do is move all the .w4a... (7 Replies)
Discussion started by: dinalt
7 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
Login or Register to Ask a Question