09-28-2012
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 does not have a correspondent file in /dir2. Condition is , It should only check files 2 days old specified in File pattern below.
ex:
/dir1 Files.
filetoTest_20120923.tar.gz
filetoTestAndCopy_20120922.tar.gz
filetoRead_20120925 (This file does not have any extension)
filetoTest_20120918.tar.gz
filetoTestAndCopy_20120925.tar.gz
filetoRead_20120927
filetoTestAndCopy_20120927.tar.gz
Now, files in /dir2/
filetoTest_20120923.tar.gz
filetoTestAndCopy_20120922.tar.gz
filetoRead_20120925 (This file does not have any extension)
filetoTest_20120918.tar.gz
Thus, the script should run and copy the files
filetoRead_20120927
filetoTestAndCopy_20120927.tar.gz
from dir1 to dir2. (Two days old)
Thanks in advance for the help.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I have 2 different folders on different machines. they are supposed to be same but some time for unknown reason they are not. then we have to generate a report for files which are not matching.
I was doing as below -
cd folder1
find . -type f | sort | cksum >1.txt
cd folder2
find .... (7 Replies)
Discussion started by: reldb
7 Replies
2. Shell Programming and Scripting
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
3. Shell Programming and Scripting
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
4. Shell Programming and Scripting
Helpppppppppppppp
Hi..
I have 2 servers with linux suse10.
I made a mistake and on one of the servers changed with chmod the permission of root in directory /.
In the other servers the permissions are correct
Please i need a script, to change the permissions of one server 1, using... (1 Reply)
Discussion started by: ave-phoenix
1 Replies
5. Shell Programming and Scripting
Hi..
I have 2 servers with linux suse10.
I made a mistake and on one of the servers changed with chmod the permission of root in directory /.
In the other servers the permissions are correct
Please i need a script, to change the permissions of one server 1, using the same permission of the... (11 Replies)
Discussion started by: ave-phoenix
11 Replies
6. Shell Programming and Scripting
This has been tearing my hair out.
I need to:
1: compare server1:/data/archive/ to server2:/data/archive/ (through rsync, ssh, etc)
2: filenames that don't match, get copied (scp) to server2:/data/
server1 and server2 have ssh, scp, rsync access between eachother.
Is there any option in... (3 Replies)
Discussion started by: damang111
3 Replies
7. Shell Programming and Scripting
I have a log file A.txt
2012/11/13 20:06:11 |t112|Locations 12, 13, 14, 15|NET12/full_ddr3_2X_FV_4BD_1.qt|norway|0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15|norway22
2012/11/14 14:23:19 |t112|Locations 0, 1, 2, 3, 4, 5, 6,... (1 Reply)
Discussion started by: sabercats
1 Replies
8. Shell Programming and Scripting
How do you compare one local folder and a remote folder and copy the difference to a third folder in a remote folder.e.g.
Folder A -- Is in a remote server and it has the following files
TEST1.OUT
TEST2.OUT
TEST3.OUT
Folder B --Is in a local server and it has the following files
... (5 Replies)
Discussion started by: cumeh1624
5 Replies
9. Shell Programming and Scripting
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
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
DKOPP(1) Dkopp man page DKOPP(1)
NAME
Dkopp - copy files to DVD or BD (Blue-ray) media
SYNOPSIS
dkopp [ -job | -run ] jobfile
dkopp [ -nogui ] -script scriptfile
DESCRIPTION
Dkopp copies files to backup DVD or BD media. It supports full
or incremental backups and full or incremental media verification.
OVERVIEW
Dkopp is a menu-driven GUI (GTK) program operating in its own window.
Dkopp copies files and directories specified in a job file to DVD or
BD media. Dkopp can copy all files to empty media (full copy), or
only new and modified files to previously used media (incremental).
Files and directories to include or exclude can be selected from the
file system hierarchy using a GUI navigator. Specifications are saved
in a job file which can be re-edited and re-used. Script files can
be run in batch mode using the -nogui option. Dkopp can be used to
select and restore files previously copied, and owner and permission
data is also restored. The DVD/BD media can also be accessed with
file system tools like Nautilus.
Dkopp supports the following functionalities:
- Three backup modes: full, incremental, accumulate.
- Three media verification modes: full, incremental, thorough.
- Use write-once or re-writable DVD or BD media (but not CD).
- Report disk:backup differences in detail or summary form.
- Select and restore files from a backup copy (or use drag and drop).
- Search log files to find media where specified files are saved.
OPTIONS
Command line options:
[ -job ] jobfile open job file for editing
-run jobfile execute a job file
[ -nogui ] -script scriptfile execute a script file
SEE ALSO
The online user manual is available using the menu Help > contents.
This manual explains Dkopp operation in great detail.
Dkopp uses the batch programs grwoisofs and genisoimage.
Dkopp is essentially a GUI front-end for these programs.
AUTHORS
Written by Mike Cornelison <kornelix2@googlemail.com>
Linux 2010-10-01 DKOPP(1)