Recursively concatenate files in subdirectories with the same folder name


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Recursively concatenate files in subdirectories with the same folder name
# 1  
Old 11-09-2009
Question Recursively concatenate files in subdirectories with the same folder name

I'm trying to concatenate files in subdirectories with the same folder name. Say concatenate all the files in the 'current' subdirectories in 'Literature' parent directory.

Literature/USA/current/
Literature/Europe/current/

Can anyone help with it? Thanks a lot!
# 2  
Old 11-09-2009
1. this works, but not to a great extent.

Code:
$ cat script.sh 
for i in `find . -not -iname '.' -type d`
do
echo $i
cd $i
find . -maxdepth 1 -type f -exec cat {} >> ./$i.file \;
cd ..
done

2. you have this same question already here..
https://www.unix.com/unix-dummies-que...#post302368457

3. try editing that script to your need, for clarifications come here again..
# 3  
Old 11-09-2009
A oneline title with nothing in the msg body wont help...provide an example of what you mean by all this.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to download recursively a folder using /usr/bin/ftp and cshell?

Hi, friends, I am meet a ftp download problem when using cshell and /usr/bin/ftp command. I want to download recursively a folder dira from FTP server. dira ---dira1-----dira2------dira3-----dira4 |--file11 |--file21 |--file31 |--file41 |--file12 |--file22 |--file32 ... (1 Reply)
Discussion started by: weichanghe2000
1 Replies

2. Ubuntu

How to find symbolic links recursively under a folder in Linux

Hi , I have folder which has almost 35000 objects, I need to find out or list the objects which are symbolic links. I tried f. I am not getting right Can you pls help Regards amv (5 Replies)
Discussion started by: amvarma77
5 Replies

3. Shell Programming and Scripting

[Solved] How to concatenate files in subdirectories?

I have many log files in various subdirectories of a parent directory. The directory structure e something like this: Parent directory: /home/linus/logfiles/ This parent directory has many subdirectories, like this: .../logfiles/jack .../logfiles/helen .../logfiles/sue... (13 Replies)
Discussion started by: zetetic
13 Replies

4. Shell Programming and Scripting

recursively remove javascript from all folder index files

Hi All, A site I manage had some javascript inserted into each folders index file. Can anyone priovide me with some ideas on how to use awk, sed or some other bash script to parse through each of the site folders and remove this code? If I have to do it by hand I'm going to go insane. :eek: ... (2 Replies)
Discussion started by: lsalsich
2 Replies

5. UNIX for Dummies Questions & Answers

recursively concatenate files in subdirectories with same folder name

I'm trying to concatenate files in subdirectories with the same folder name. Say concatenate all the files in the 'current' subdirectories in 'Literature' parent directory. Literature/USA/current/ Literature/Europe/current/ Can anyone help with it? Thanks a lot! (2 Replies)
Discussion started by: joyce007
2 Replies

6. UNIX for Dummies Questions & Answers

ls command to list recursively ONLY subdirectories

:confused: ls -dlRr I've tried different combinations of the ls command using the above-mentioned options but none of them are giving me the output I am looking for. Objective: To get a recursive listing of all subdirectories from a particular starting point. For example, if my starting... (5 Replies)
Discussion started by: HLee1981
5 Replies

7. Shell Programming and Scripting

Recursively go thorough subdirectories and checkout files

Hi, I would need to go through all the subdirectories, find each file and would need to check them out(using clearcase, which I know). But could you please help me how to find all the files under all subdirectories.. there could be multiple directories and subdirs... Sas (3 Replies)
Discussion started by: shajiasalim
3 Replies

8. Shell Programming and Scripting

FTP command to search recursively in windows folder

Hi what command to be used to FTP files from the windows directory into a folder in unix environment using shell script The script should be able to recursively search into 100 subdirectories within my windows directory for .xml files. Can anyone help me with this... thnx (6 Replies)
Discussion started by: lakshmis10
6 Replies

9. Shell Programming and Scripting

Concatenate all the files in folder on timestamps

Hi Gurus, Experts, I am facing a problem to concatenate all the files based on timeStamps. The Problem is like this . The are many files in a folder Which are of the below types Ack_to_MDS_20070809141159.xml Ack_to_MDS_20070809141157.xml Ack_to_MDS_20070809141155.xml... (19 Replies)
Discussion started by: srikanthgr1
19 Replies

10. UNIX for Dummies Questions & Answers

How to move recursively into one folder

Hi, I have a folder with a million subdirectories which all have a million files in them (some of them duplicates).. I am looking for the right program command to move all of the files out of the directories and into one folder-- and replace all of the duplicates.. If anyone has any ideas,... (2 Replies)
Discussion started by: patrick99e99
2 Replies
Login or Register to Ask a Question