The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Auto copy for files from folder to folder upon instant writing Bashar UNIX for Advanced & Expert Users 2 08-21-2008 03:44 PM
FTP command to search recursively in windows folder lakshmis10 Shell Programming and Scripting 6 10-18-2007 06:09 AM
How can i move data files from a server to unix folder shah2 Shell Programming and Scripting 1 03-01-2004 06:38 PM
how to copy/move folder on XP to Solaris? simt UNIX for Dummies Questions & Answers 2 07-28-2003 01:01 PM
move files from folder thats are not empty Steven UNIX for Dummies Questions & Answers 8 11-21-2001 10:05 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-27-2006
patrick99e99 patrick99e99 is offline
Registered User
  
 

Join Date: Jun 2006
Location: los angeles
Posts: 13
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, that would be great. thanks!

-patrick
  #2 (permalink)  
Old 06-27-2006
qfwfq qfwfq is offline
Registered User
  
 

Join Date: Feb 2005
Location: Canada
Posts: 133
Here, that should do it. All files having the same name will be overwritten but at the end, you will have only a copy of each file...

Code:
#!/usr/bin/sh

DES_DIR=name of the destination directory for the files to be copied
ORI_DIR=your original directory containing all subdirectories

cd $ORI_DIR
find . -type f  -exec cp {} $DES_DIR \;
I suggest you use the cp command in the script and then remove the files manually using command line.
  #3 (permalink)  
Old 06-27-2006
patrick99e99 patrick99e99 is offline
Registered User
  
 

Join Date: Jun 2006
Location: los angeles
Posts: 13
thank you so much! that worked perfectly.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:56 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0