![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Synchronize your databases with SqlSync | iBot | UNIX and Linux RSS News | 0 | 05-08-2008 11:20 AM |
| need a way to synchronize processes | inabramova | High Level Programming | 1 | 03-20-2008 01:12 PM |
| Solaris 9: How to set time/Synchronize | 0ktalmagik | UNIX for Advanced & Expert Users | 3 | 07-16-2006 09:53 PM |
| How to synchronize all the linux machine? | whatisthis | Shell Programming and Scripting | 1 | 11-12-2004 11:07 AM |
| synchronize as in java | linuxpenguin | High Level Programming | 8 | 03-14-2004 09:02 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 of them are brand new. I need a finaloutput as dir1 having all the files from all other 3 directory but not having its original files same for other dirs. And i need to change the file name in dir1. Actually all the files are having a ext as .text so i need to remove the .text from all the files. eg dir1 file5 file6 file8 file9 file10 file12 file15 dir2 file1 file2 file4 file9 file10 file12 file15 I am doing like this newdir1 - copying all the files from dir2 dir3 and dir4 then delete the files from newdir1 which are there in dir1 so this way newdir1 is my final result. Doing the same for other directory >mkdir newdir1 > cp dir2/* ./newdir1 > cp dir3/* ./newdir1 > cp dir4/* ./newdir1 ls dir1 | while read file; do rm ./newdir1/${file} done cd newdir1 ls | while read file; do mv ${file} `echo ${file} | sed 's/\.txt//'` done Is there any other best and fast way to do? Actually i need some way which can be much more efficient than this instead of using 2 while loops as i have more than 5000 files in each folder and most of them are common across each folder only 20 are new files. can i do this through file manipulation means instead of working on actual file if i make a file with all the filename and then doing some commands on names instead of actual file and then finally copying the actual file Last edited by reldb; 12-09-2006 at 05:13 PM.. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|