Sponsored Content
Top Forums Shell Programming and Scripting Compare the checksum of files in 2 different folders Post 302381648 by pludi on Saturday 19th of December 2009 10:34:05 AM
Old 12-19-2009
How about using chksums -c option? On the first machine run
Code:
cd /dir1
find . -type f -exec chksum {} \; > chksums

Copy it over to the other machine and run
Code:
cd /dir2
chksum -c chksums

That should give you a listing of those files that differ.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remote compare of folders

Hi, Is there a way (either commands/tools/scripts/logic) to compare two given folders on different unix boxes. I want to compare folder a in Unix box 'A' with folder 'b' in Unix box 'B'. I can run the script in Unix box 'A'. I am looking. for following results: files/sub folders only in a... (1 Reply)
Discussion started by: sunilav
1 Replies

2. Shell Programming and Scripting

Compare 2 folders...

Hello, I try to compare 2 folders, i explain, i have file in this 2 folder and i want to print out the difference in this folders... ex: folder1: file1 file2 file3 folder2: file1 file2 print file3 I do a ls of the 2 folders and i use the command diff (diff $var1 $var2) without... (8 Replies)
Discussion started by: protocomm
8 Replies

3. Shell Programming and Scripting

Compare files in two folders and delete missing ones

I do not know much about shell scripting so I am at a loss here. If someone can help me, that would be great! I have two directories /dir1 /dir2 I need to delete all files from /dir1 and that does not have a correspondent file in /dir2. It should NOT check file suffixes in /dir2 . Why?... (20 Replies)
Discussion started by: kaah
20 Replies

4. Shell Programming and Scripting

Compare 2 folders to find several missing files among huge amounts of files.

Hi, all: I've got two folders, say, "folder1" and "folder2". Under each, there are thousands of files. It's quite obvious that there are some files missing in each. I just would like to find them. I believe this can be done by "diff" command. However, if I change the above question a... (1 Reply)
Discussion started by: jiapei100
1 Replies

5. Shell Programming and Scripting

How to compare files in two folders using cmp?

i recently copied 400GB of data from a NTFS drive to a ext4 drive. I want to verify that the data is 100% identical to the original. I wanted to use cmp but it only does two files. The directory that was copied contains many subdirectories and all sorts of files (not just text). So I guess... (5 Replies)
Discussion started by: fuzzylogic25
5 Replies

6. UNIX for Dummies Questions & Answers

Searching for folders/parent folders not files.

Hello again, A little while back I got help with creating a command to search all directories and sub directories for files from daystart of day x. I'm wondering if there is a command that I've overlooked that may be able to search for / write folder names to an output file which ideally... (2 Replies)
Discussion started by: Aussiemick
2 Replies

7. IP Networking

Wireshark UDP checksum bad checksum

Hello I am communicating with two devices using my computer over UDP protocol. The application is running fine. When I monitored the UDP traffic using Wireshark software, I found that there were too many Checksum errors. Please find attached the png file showing this error. I am about to... (0 Replies)
Discussion started by: AustinCann
0 Replies

8. Shell Programming and Scripting

Linux Script to compare two folders and copy missing files

Hi, I need help in shell scripting. If someone can help me, that would be great! Problem. I want Linux Script to compare two folders and copy missing files. Description. I have two directories /dir1 /dir2 I need to copy all distinct/new/unique/missing files from /dir1 and that... (1 Reply)
Discussion started by: S.Praveen Kumar
1 Replies

9. Shell Programming and Scripting

How to copy files/folders and show the files/folders?

Hi, So i know we use cp -r as a basic to copy folders/files. I would like this BUT i would like to show the output of the files being copied. With the amazing knowledge i have i have gone as far as this: 1) find source/* -exec cp -r {} target/ \; 2) for ObjectToBeCopied in `find... (6 Replies)
Discussion started by: Imre
6 Replies

10. Shell Programming and Scripting

Script to compare files in 2 folders and delete the large file

Hello, my first thread here. I've been searching and fiddling around for about a week and I cannot find a solution.:confused: I have been converting all of my home videos to HEVC and sometimes the files end up smaller and sometimes they don't. I am currently comparing all the video files... (5 Replies)
Discussion started by: Josh52180
5 Replies
mv(1)							      General Commands Manual							     mv(1)

NAME
mv - Moves files and directories SYNOPSIS
mv [-i | -f] [--] file1 file2 mv [-i | -f] [--] file1... directory mv [-i | -f] [--] directory1... destination_directory The mv command moves files from one directory to another or renames files and directories. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: mv: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Overrides the -i option and any mode restrictions. (If both -f and -i are specified--for example, because an alias includes one of them--whichever appears last overrides the other.) Prompts you with the name of the file followed by a question mark whenever a move is to supersede an existing file. If the answer begins with y, or the locale's equivalent of a y, the move continues. Any other reply prevents the move from occurring. (If both -f and -i are specified--for example, because an alias includes one of them--whichever appears last over- rides the other.) Interprets all following arguments to mv as file names. This allows file names to start with a - (dash). DESCRIPTION
If you move a file to a new directory, mv retains the original file name. When you move a file, all other links to the file remain intact. In the second form, one or more files are moved to directory with their original file names. In the third form, one or more directories are moved to the destination directory with their original names. The mv command does not move a file onto itself. When you use mv to rename a file, the target file can be either a new file name or a new directory path name. If moving the file would overwrite an existing file that does not have write permission set and if standard input is a terminal, mv displays the permission code of the file to be overwritten and reads one line from standard input. If the line begins with y, or the locale's equivalent of a y, the move takes place and the file is overwritten. If not, mv does nothing with the file. When you use mv to move a directory into an existing directory, the directory and its contents are added under the existing directory. The LC_MESSAGES variable determines the locale's equivalent of y or n (for yes/no queries). If a mv operation fails, mv generally writes a diagnostic message to standard error, does nothing more with the current source file, and goes on to process any remaining source files. If the copying or removal of a file is prematurely terminated by a signal or error, mv might leave a partial copy of the file at either the source or the target path name. The mv program does not modify the source and target path names simultaneously; therefore, program termina- tion at any point always leaves either the source file or the target file complete. NOTES
[Tru64 UNIX] If the source is on a different file system than the destination, mv must copy the source to the destination's file system and then delete the source. The effect is equivalent to the following: rm -f destination && cp -pr source destination && rm -rf source The mv command might overwrite existing files. Specify the -i option last on the command line to cause the mv command to prompt you before it moves a file. EXIT STATUS
The following exit values are returned: All files were moved successfully. An error occurred. EXAMPLES
To rename a file, enter: mv file1 file2 This renames file1 to file2. If a file named file2 already exists, its old contents are replaced with those of file1. To move a directory, enter: mv dir1 dir2 This moves dir1 to dir2. It moves dir1 and all files and directories under dir1 to the directory named dir2, if the second direc- tory exists. Otherwise, the directory dir1 gets renamed dir2. To move a file to another directory and give it a new name, enter: mv file1 dir1/file2 This moves file1 to dir1/file2. The name file1 is removed from the current directory, and the same file appears as file2 in the directory dir1. To move a file to another directory, keeping the same name, enter: mv file1 dir1 This moves file1 to dir1/file1. To move several files into another directory, enter: mv file1 dir1/file2 /u/dir2 This moves file1 to /u/dir2/file1 and dir1/file2 to /u/dir2/file2. To use mv with pattern-matching characters, enter: mv dir1/* . This moves all files in the directory dir1 into the current directory (.), giving them the same names they had in dir1. This also empties dir1. Note that you must type a space between the * (asterisk) and the (dot). ENVIRONMENT VARIABLES
The following environment variables affect the execution of mv: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the for- mat and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO
Commands: cp(1), ln(1), rm(1) Functions: rename(2) Standards: standards(5) mv(1)
All times are GMT -4. The time now is 10:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy