Recursively dump all sub-dirs contents?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Recursively dump all sub-dirs contents?
# 1  
Old 10-12-2010
Recursively dump all sub-dirs contents?

Hi,

I have a dir structure that has many many subdirs, I would like to dump all the files from al the sub-dirs into a single directory? Can someone tell me the mv command that would do this please?

before example:
datadir/
datadir/datajan/jan.dat
datadir/datafeb/feb.dat

after example:
datadir/
datadir/datajan.dat
datadir/datafeb.dat

and so on.....

thanks in advance for any help.
regards
# 2  
Old 10-12-2010
Try this....
cd upto datadir/
Code:
find . -name "*.dat" -exec cp {} /path/where/you/want/files/copied \;

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading URL using Mechanize and dump all the contents of the URL to a file

Hello, Am very new to perl , please help me here !! I need help in reading a URL from command line using PERL:: Mechanize and needs all the contents from the URL to get into a file. below is the script which i have written so far , #!/usr/bin/perl use LWP::UserAgent; use... (2 Replies)
Discussion started by: scott_cog
2 Replies

2. Shell Programming and Scripting

Folder contents getting appended as strings while redirecting file contents to a variable

Hi one of the output of the command is as below # sed -n "/CCM-ResourceHealthCheck:/,/---------/{/CCM-ResourceHealthCheck:/d;/---------/d;p;}" Automation.OutputZ$zoneCounter | sed 's/$/<br>/' Resource List : <br> *************************** 1. row ***************************<br> ... (2 Replies)
Discussion started by: vivek d r
2 Replies

3. UNIX for Dummies Questions & Answers

**HELP** how to do a listing of dirs and all sub dirs only

I am trying to get a listing of ALL directories only under /export (as an example). I can get all the dirs directly under /export but I need any sub dirs under those dirs. I've looked (here and google) but can not find anything that works (4 Replies)
Discussion started by: bbraml
4 Replies

4. UNIX for Advanced & Expert Users

script to recursively change permissions on file and dirs differently?

Hi there, I need to change all files/dirs 1. all files with 744 2. all dirs with 755 is there a script for that ? thanks, thegunman (13 Replies)
Discussion started by: TheGunMan
13 Replies

5. UNIX for Dummies Questions & Answers

delete recursively contents of folders

hi, I've a folder structure like : /home/project/LIBNAMEA/FILE1 /home/project/LIBNAMED/FILE2 /home/project/LIBNAMEC/FILE3 /home/project/LIBNAMED/FILE4 /home/project/LIBNAMEX/FILE5 (there is no relation in the letters after the project/ ) and i need to delete the files keeping... (5 Replies)
Discussion started by: jtmartins
5 Replies

6. Shell Programming and Scripting

monitoring dirs

Hi there, Presently using du -ks and storing all directory summaries manually. Is there any other way or easier way to accomplish monitoring directories and check everyday/week for updates on particular dirs that I am interested in. Automation of this functionality maybe? (1 Reply)
Discussion started by: da-seot
1 Replies

7. Shell Programming and Scripting

how to synchronize different dirs

I have 4 directory Dir1 file1 file2 file3 file4 Dir2 file3 file5 file6 file8 Dir3 file1 file2 file6 file9 file10 Dir4 file3 file6 file12 file15 and all the 4 dirs are having couple of files. Few of the files are common to other directory/ies and few... (1 Reply)
Discussion started by: reldb
1 Replies

8. UNIX for Dummies Questions & Answers

Combining Two Dirs

I have two Directories, foo and foobar. I want to combine the contents of foo into foobar. There is probably a simple command for this, but I have yet to find it. Thanks in advance, Robert (2 Replies)
Discussion started by: Phobos
2 Replies

9. UNIX for Dummies Questions & Answers

I need to ls all files in 4-6 deep dirs

I need to print to file , a listing of all files below a certain directory. Example: I need to print to file a listing of all files below the etc dir (including the subdirectories) with their full path. Any ideas on how to do this with one command. Or is this something I need to do on all... (4 Replies)
Discussion started by: gforty
4 Replies

10. UNIX for Dummies Questions & Answers

help, what is the difference between core dump and panic dump?

help, what is the difference between core dump and panic dump? (1 Reply)
Discussion started by: aileen
1 Replies
Login or Register to Ask a Question