Script to find a file in the other folder


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to find a file in the other folder
# 1  
Old 04-10-2008
Data Script to find a file in the other folder

Hi,

I have two folders in two different directories.Both the folders contain set of text files. The name of the files are same in both the folders. I need to write a script to compare all the files in both the folders having same name. I am new to unix. Can you help me out in giving a script to do this job?

Thanks.
# 2  
Old 04-10-2008
CPU & Memory Use dircmp

Hi,

Use dircmp command for finding all the files that are common in both the directories. Its available in Solaris.

Usage :
dircmp <directory1> <directory2>

Note : Give full path where ever necessary.

Output :
For all the files that are common u will find the work "same" associated with the filename

same <file1>
same <file2>


Let me know if you need any more help.....
# 3  
Old 04-10-2008
Finding a file in the other folder

Hi,

Does dircmp check only for the matching of file names present in the first folder with the second folder or does it compare for the contents of the both the files with the same name?
# 4  
Old 04-10-2008
MySQL

Hi,

Does dircmp check only for the matching of file names present in the first folder with the second folder or does it compare for the contents of the both the files with the same name?


Hey ragavhere,

Good question. Yeah .. it can compare the contents of the file and also tells what needs to be added to get in sync.
Here are some options other than that.

- d Compares the contents of files with the same name in
both directories and output a list telling what must
be changed in the two files to bring them into agree-
ment. The list format is described in diff(1).

-s Suppresses messages about identical files.

-w n Changes the width of the output line to n characters.
The default width is 72.

Smilie
# 5  
Old 04-11-2008
Comporing folders

Thanks. it worked..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find common lines with one file and with all of the files in another folder

Hi! I would like to comm -12 with one file and with all of the files in another folder that has a 100 files or more (that file is not in that folder) to find common text lines. I would like to have each case that they have common lines to be written to a different output file and the names of the... (6 Replies)
Discussion started by: Eve
6 Replies

2. UNIX for Beginners Questions & Answers

UNIX utility to find difference in folder, file and contents of file against a base version

Hi, I am trying to find out whether there are any Unix utilities that compares folders, files and contents within the file and provides a comprehensive report. The comparison can be against base version of a folder and file with content. Can you please let me know of such a utility? Thanks,... (6 Replies)
Discussion started by: Sripathi_ks
6 Replies

3. Shell Programming and Scripting

File to Folder script

I am trying to write a linux shell script that will take every file in a folder /home/user/desktop/fileme and place it in a folder with the same name as the folder before /home/user/desktop/fileme/stuff.txt /home/user/desktop/fileme/other.avi /home/user/desktop/fileme/last.jpg after... (2 Replies)
Discussion started by: FustFust
2 Replies

4. Shell Programming and Scripting

Find folder within folder, then find other folder in same dir

Hi all I'm new to your forum but not new to shells. I'm having a little trouble though as it's been quite some time since I scripted. Here's what I'm trying to do: I'm trying to search a directory named '/var/root/Applications' for another directory 'fooBar'. The "Applications" directory... (9 Replies)
Discussion started by: DC Slick
9 Replies

5. Shell Programming and Scripting

Find all text files in folder and then copy to a new folder

Hi all, *I use Uwin and Cygwin emulator. I´m trying to search for all text files in the current folder (C/Files) and its sub folders using find -depth -name "*.txt" The above command worked for me, but now I would like to copy all found text files to a new folder (C/Files/Text) with ... (4 Replies)
Discussion started by: cgkmal
4 Replies

6. UNIX for Dummies Questions & Answers

Disk Usage in GB and Unix command to find the biggest file/folder

Hi All, Please help me out 1) Command to find the disk usage in GB. I know that du -k will give in kilobites. 2) How to find the Biggest file/folder in a given set of files/folders. Thanks in advance Regards, Manas (8 Replies)
Discussion started by: manas6
8 Replies

7. UNIX for Dummies Questions & Answers

Find a file in a folder-please help

HI , I have a very small requirement here. I need to find a file say which ends with .gz in a folder. If i found this file then i need to echo" file found" and do a word count of the file and if not i need to echo file not found and exit from the loop. i have written this script but i am only... (7 Replies)
Discussion started by: bsandeep_80
7 Replies

8. Shell Programming and Scripting

Shell script to find out 2 last modified files in a folder..PLZ HELP!!!!!!!!!

hi all, I need to find out the last 2 modified files in a folder.There is some way by which,we can check the timestamp and find out..??please help this is urgent. Thanks in Advance Anju (3 Replies)
Discussion started by: anju
3 Replies

9. Shell Programming and Scripting

Take a folder name and find it in another folder (Complicated)

Hi Script Experts, Here is my scenario: 1. /var/mqm/qmgrs folder will contain 11 folders as follows: 1. /var/mqm/qmgrs/Folder_Name1 ....................../Folder_Name2 ....................../Folder_Name3 ....... ...................../Folder_Name11 2. if Folder_Name1 exists... (5 Replies)
Discussion started by: hkhan12
5 Replies

10. UNIX for Dummies Questions & Answers

how to differentiate a file from a folder in a FIND?

I have to read a complete folder and if it is a file older that 7 days I have to copy it elsewhere and if it is a folder nothing to make. The way I do it: for I in `find /home/. -name "*" -mtime +7` do cp -Rf $I /home/elsewhere/. done Am I okay with the way I want to do it? Help... (3 Replies)
Discussion started by: denysQC
3 Replies
Login or Register to Ask a Question