LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-23-2014, 11:32 AM   #1
Alok Behria
LQ Newbie
 
Registered: Jun 2012
Posts: 5

Rep: Reputation: Disabled
How to script to check files and their sizes on different mount points


Hi All,

I am using Red Hat Enterprise Linux Server release 5.8 and need one help. here , I am trying to check files and their sizes, in case, they are not matched , I need to produce the files , which are not identical in terms on names and size. following are 2 mount points. the one is source and the other is target. now, I need to compare files target to source , if they matches. the source and target has around 28 mount points.

------

Source -- /db/ptmtrain/data**/*dbf*
Target -- /db/ptmqa/data**/*dbf*

Regards
Alok
 
Old 05-23-2014, 12:53 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Alok Behria View Post
Hi All,
I am using Red Hat Enterprise Linux Server release 5.8 and need one help. here , I am trying to check files and their sizes, in case, they are not matched , I need to produce the files , which are not identical in terms on names and size. following are 2 mount points. the one is source and the other is target. now, I need to compare files target to source , if they matches. the source and target has around 28 mount points.
------
Source -- /db/ptmtrain/data**/*dbf*
Target -- /db/ptmqa/data**/*dbf*
Ok, we'll be happy to help you. So post what you have written/tried of your own, and tell us where you're stuck. But we aren't going to write your shell scripts for you; there are MANY easily-found bash scripting guides with examples, and there's even one in my posting signature here.

Start by reading the man pages on the find command. You can recurse directory trees with it, and find files matching a particular pattern (such as *dbf*), and return the size of those files. From there, you can perform whatever actions you want.
 
Old 05-28-2014, 05:19 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Are you trying to compare the filenames or the sizes (or the contents ?)

1. filenames you need to produce sorted lists of src & destn, then diff them
2. as per 1, but now you can compare sizes eg 'ls -l' for each file
3. contents - use a checksum eg sha512sum
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Assistance in Shell script on placing files across mount points. manickaraja Programming 15 02-27-2010 02:53 AM
Rebuilt RAID array with old mount points present; file system check fails on boot... mvb187 Linux - Software 3 12-04-2009 08:38 AM
Bash script for sorting out FSTAB & mount points ? Sparxz Linux - Newbie 1 05-30-2009 07:04 PM
Files and mount points: best practices SwissHeritage Linux - General 16 04-10-2009 01:04 AM
SCRIPT: check if auto-mount mount-points are still mounted markus1982 Linux - Software 0 05-25-2003 05:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration