Sponsored Content
Full Discussion: Rsync files check
Top Forums Shell Programming and Scripting Rsync files check Post 302986864 by Abu Rayane on Wednesday 30th of November 2016 11:19:12 PM
Old 12-01-2016
Well, this is the first part of the script, hope is good:

Code:
#!/bin/bash

dirName='/root/Scripts/Misc'

# Loop through directories
for elems in $(find $dirName -mindepth 1)
do

# if is file
if [[ -f $elems ]]; then

# Get file md5sum
md5=$(md5sum $elems | awk '{print $1}')

# if is directory
else

# get how many files inside this directory
md5=$(find $elems -type f | wc -l)

fi

# Get files size
fileSize=$(stat -c %s $elems)

# Print everything in one line
echo -e "$elems : $md5 : $fileSize" >> log

done

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

rsync, which files where moved?

Hello, I am using rsync to make sure that my folder "local" mirrors the remote directory "remote". When a file is copied from "remote" to "local", I need to apply a bash script to it. What would be a neat way to do that? Thanks ps: is there a way to edit the title of the thread (I am a bit... (5 Replies)
Discussion started by: JCR
5 Replies

2. Solaris

Using RSYNC to copy files locally

Has anyone ever used rsync to copy files locally on one server? (in this case from one SAN volume to another). I am familiar with using rsync to copy files between servers, but not locally, I would usually use cp or or tar or something. Is rsync slower? Does it use additional overhead of the... (4 Replies)
Discussion started by: BG_JrAdmin
4 Replies

3. Shell Programming and Scripting

Rsync temporary files

Hi, I am looking to use rsync in a very specific way, and even though I have trawled the rsync man pages I have not succeeded in seeing a way of doing the following: The temporary files created by rsync should not be created in the destination directory. (I have used --temp-dir option to... (0 Replies)
Discussion started by: LostInTheWoods
0 Replies

4. Shell Programming and Scripting

rsync copy files once

Hi This is my situation I have files on the left which I want to copy to the right. Once the files are copied to the right, they are processed and then deleted. The next time rsync runs I dont want it to copy the same files again, it should only copy any new files to the right. I have been... (4 Replies)
Discussion started by: duonut
4 Replies

5. Linux

Modifying Rsync script to check source

Hi I am running rsyncs between a raid attached server and a nas device, which works fine. I am using the --delete to ensure that its kept in sync. And running a log at the end of the sync for me to check. this i am running from a cron Problem is if the part of the raid fails on the server the... (1 Reply)
Discussion started by: treds
1 Replies

6. Shell Programming and Scripting

Perl code to check date and check files in particular dir

Hi Experts, I am checking how to get day in Perl. If it is “Monday” I need to process…below is the pseudo code. Can you please prove the code for below condition. if (today=="Monday" ) { while (current_time LESS THAN 9:01 AM) ... (1 Reply)
Discussion started by: ajaypatil_am
1 Replies

7. UNIX for Dummies Questions & Answers

Does rsync check and ignore files that already exist?

Hi, We have two (2) servers named primary and standby. There is a directory named /db01/archive that we need to keep in-sync. Files get transferred from primary and standby. Sometimes when we do a failover or when there is a network issue, some files fail to get transferred. I want to use... (3 Replies)
Discussion started by: newbie_01
3 Replies

8. Shell Programming and Scripting

Rsync Error: rsync: link_stat failed: No such file or directory (2)

I wish to copy all the files & folder under /web/Transfer_Files/data/ on mymac1 (Linux) to remote server mybank.intra.com (Solaris 10) /tmp/ location I am using Ansible tool synchronize module which triggers the unix rsync command as below:rsync --delay-updates -F --compress --archive --rsh=ssh... (2 Replies)
Discussion started by: mohtashims
2 Replies

9. Shell Programming and Scripting

Rsync and Move files

I Have a requirement where i have to sync two directories one on source location server A and other on destination location server B as i do not have ssh access from server A----------->B I am doing rsync from server B, The Requirement is as follows Two directories on the source and... (4 Replies)
Discussion started by: James0806
4 Replies

10. Ubuntu

Rsync - not copy certain files

I use this rsync --progress -r -u /media/andy/MAXTOR_SDB1/Ubuntu_Mate_18.04/* /home/andy/Ubuntu_18.04_Programs/Is there a way to have it not copy files such as these? 2019-02-25_11:04 I found this but can not figure out what it's doing. 3. Exclude a specific file To exclude a... (5 Replies)
Discussion started by: drew77
5 Replies
MD5(3)									 1								    MD5(3)

md5 - Calculate the md5 hash of a string

SYNOPSIS
string md5 (string $str, [bool $raw_output = false]) DESCRIPTION
Calculates the MD5 hash of $str using the RSA Data Security, Inc. MD5 Message-Digest Algorithm, and returns that hash. PARAMETERS
o $str - The string. o $raw_output - If the optional $raw_output is set to TRUE, then the md5 digest is instead returned in raw binary format with a length of 16. RETURN VALUES
Returns the hash as a 32-character hexadecimal number. EXAMPLES
Example #1 A md5(3) example <?php $str = 'apple'; if (md5($str) === '1f3870be274f6c49b3e31a0c6728957f') { echo "Would you like a green or red apple?"; } ?> NOTES
Note Secure password hashing It is not recommended to use this function to secure passwords, due to the fast nature of this hashing algorithm. See here for details. SEE ALSO
md5_file(3), sha1_file(3), crc32(3), sha1(3), hash(3), crypt(3), password_hash(3). PHP Documentation Group MD5(3)
All times are GMT -4. The time now is 03:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy