Sponsored Content
Top Forums Shell Programming and Scripting Compare the checksum of files in 2 different folders Post 302381598 by ichigo on Saturday 19th of December 2009 12:39:56 AM
Old 12-19-2009
Code:
diff directory1 directory2

 

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
File::NCopy(3pm)					User Contributed Perl Documentation					  File::NCopy(3pm)

NAME
File::NCopy - Deprecated module. Use File::Copy::Recursive instead. Copy file, file. Copy file[s] | dir[s], dir SYNOPSIS
use File::NCopy qw(copy); copy "file","other_file"; copy "file1","file2","file3","directory"; # we want to copy the directory recursively copy 1,"directory1","directory2"; copy 1,"file1","file2","directory1","file3","directory2","file4", "directory"; # can also use references to file handles, this is for backward # compatibility with File::Copy copy *FILE1,*FILE2; copy *FILE1,"file"; copy "file1",*FILE2; # we don't specify 1 as the first argument because we don't want to # copy directories recursively copy "*.c","*.pl","programs"; copy "*", "backup"; use File::NCopy; # the below are the default config values $file = File::NCopy->new( 'recursive' => 0, 'preserve' => 0, 'follow_links' => 0, 'force_write' => 0, 'set_permission' => &File::NCopy::u_chmod, 'file_check' => &File::NCopy::f_check, 'set_times' => &File::NCopy::s_times, ); set_permission will take two file names, the original to get the file permissions from and the new file to set the file permissions for. file_check takes two parameters, the file names to check the file to copy from and the file to copy to. I am using flock for Unix systems. Default for this is &File::NCopy::f_check. On Unix you can also use &File::NCopy::unix_check. This one compares the inode and device numbers. set_times is used if the preserve attribute is true. It preserves the access and modification time of the file and also attempts to set the owner of the file to the original owner. This can be useful in a script used by root, though enyone can preserve the access and modification times. This also takes two arguments. The file to get the stats from and apply the stats to. On Unix boxes you shouldn't need to worry. On other system you may want to supply your own sub references. $file = File::NCopy->new(recursive => 1); $file->copy "file","other_file"; $file->copy "directory1","directory2"; $file = File::NCopy->new(u_chmod => &my_chmod,f_check => &my_fcheck); $file->copy "directory1","directory2"; DESCRIPTION
File::NCopy::copy copies files to directories, or a single file to another file. You can also use a reference to a file handle if you wish whem doing a file to file copy. The functionality is very similar to cp. If the argument is a directory to directory copy and the recursive flag is set then it is done recursively like cp -R. In fact it behaves like cp on Unix for the most part. If called in array context, an array of successful copies is returned, otherwise the number of successful copies is returned. If passed a file handle, it's difficult to make sure the file we are copying isn't the same that we are copying to, since by opening the file in write mode it gets pooched. To avoid this use file names instead, if at all possible, especially for the to file. If passed a file handle, it is not closed when copy returns, files opened by copy are closed. copy Copies a file to another file. Or a file to a directory. Or multiple files and directories to another directory. Or a directory to another directory. Wildcard arguments are expanded, except for the last argument which should not be expanded. The file and directory permissions are set to the orginating file's permissions and if preserve is set the access and modification times are also set. If preserve is set then the uid and gid will also be attempted to be set, though this may only for for the men in white hats. In list context it returns all the names of the files/directories that were successfully copied. In scalar context it returns the number of successful copies made. A directory argument is considerd a single successful copy if it manages to copy anything at all. To make a directory to directory copy the recursive flag must be set. cp Just calls copy. It's there to be compatible with File::Copy. new If used then you can treat this as an object oriented module with some configuration abilities. recursive If used as an object then you can use this to set the recursive attribute. It can also be set when instantiating with new. The other attributes must all be set when instantiating the object. If it isn't specified then directories are not followed. preserve Attempt to preserve the last modification and access time as well as user and group id's. This is a useful feature for sysadmins, though the access and modification time should always be preservable, the uid and gid may not. follow_links If the link is to a directory and this attribute is true then the directory is followed and recursively copied. Otherwise a link is made to the root directory the link points to. eg. /sys/ is a link to /usr/src/sys/ is a link to /usr/src/i386/sys then the link /sys/ is actually created in the source directory as a link to /usr/src/i386/sys/ rather than /usr/src/sys/ since if the link /usr/src/sys/ is removed then we lost the link even though the directory we originally intended to link to still exists. force_write Force the writing of a file even if the permissions are read only on it. EXAMPLE
See SYNOPSIS. BUGS
When following links the target directory might not exactly the same as the source directory. The reason is that we have to make sure we don't follow circular or dead links. This is really a feature though the result may not quite resemble the source dir, the overall content will be the same. :) From Ken Healy (Version 0.34) On Win32, The use of backslash for paths is required. AUTHOR
Gabor Egressy gabor AT vmunix.com Copyright (c) 1998 Gabor Egressy. All rights reserved. All wrongs reversed. This program is free software; you can redistribute and/or modify it under the same terms as Perl itself. Some ideas gleaned from File::Copy by Aaron Sherman & Charles Bailey, but the code was written from scratch. Patch at versions 0.33, and 0.34 added by MZSANFORD. 0.35, 0.36 - Alexandr Ciornii (alexchorny AT gmail.com) perl v5.12.3 2011-06-18 File::NCopy(3pm)
All times are GMT -4. The time now is 10:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy