Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Rsync copy files if dont exist Post 302723587 by Spadez on Tuesday 30th of October 2012 11:43:04 AM
Old 10-30-2012
Rsync copy files if dont exist

I have a setup where I have two drives.
  • TV
  • TVbackup

For what ever reason, I have a lot of content on my TVbackup drive which isn't on my TV drive.
  1. I want to copy all the files across which are on TVbackup but are not currently on TV.
  2. If there is a file with the same name but a different size or date, I want to copy this across too, perhaps with a (1) after it, or something similar so it doesnt overwrite the existing file.

The end result is that the TV drive will end up having all of the files which are on the TVbackup drive as well as its own files.

My starting point is this:
Code:
rsync /media/tvbackup /media/tv

But how do I make it skip if the same file (size and date) already exists in the destination.

Last edited by vbe; 10-30-2012 at 12:55 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Tab Completion showing files that Dont Exist

Has anyone seen this before? if i ls a particular directory (an email Maildir) i get a long list of files, if i 'du -h' that same directory, i get messages like: du: `./1053894791.17207_0.srweb,S=6199': No such file or directory strange. so using tab will complete this filename too, giving... (3 Replies)
Discussion started by: dittonamed
3 Replies

2. Shell Programming and Scripting

How to check a file exist and do a copy of other files

Hi, I would like to perform bash which would check the file A.txt to be size 0 or not. If the size is 0, I would copy file B.txt to replace A.txt. Please help. Thanks. -Jason (6 Replies)
Discussion started by: ahjiefreak
6 Replies

3. 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

4. HP-UX

Copy only files whiich do not exist on Target Directory

Hi, I am using HP-UX B 11.23 I want to copy files from one directory into another directory in such a way that, only the nonexistent files in target directory are copied from source directory e.g. dir1 has file1 file2 file3 dir2 has file1 file3 now I want that a command... (7 Replies)
Discussion started by: Chetanaz
7 Replies

5. UNIX for Dummies Questions & Answers

copy files as space exist in file name..

Hi, i am having a directory in which files are having space in the name . $ls -1 aa b.txt my file.pdf lost file.csv foo_file.txti want to copy those file to some where with date +%F as extension . But it failed for the file having space. #!/bin/sh ls -1 >tt for var in `cat tt` do b=$var... (2 Replies)
Discussion started by: posix
2 Replies

6. Shell Programming and Scripting

Extract columns from a file if the name dont exist put blank

Hi, I am very new to Unix script. Suppose i have a file with column header: NAME1 NAME2 Address Tel And I always need to make a file with column header: ID NAME1 NAME2 EMail Address Tel For the columns that do not exist in the file, I would still like to make a column with blank. ... (11 Replies)
Discussion started by: nightrider
11 Replies

7. 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

8. 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

9. Shell Programming and Scripting

Rsync to copy specific subfolders and files to new directory

RootFolderI: RootFolderI/FolderA/Subfolder1/Subsub1/JPG1.jpg -> want this jpg RootFolderI/FolderA/Subfolder2/Subsub1/JPG2.jpg -> want this jpg RootFolderI/FolderA/Subfolder2/Subsub2/JPG3.jpg . . . RootFolderI/FolderB/Subfolder1/Subsub1/JPG4.jpg -> want this jpg ... (1 Reply)
Discussion started by: blocnt
1 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
mt(1)							      General Commands Manual							     mt(1)

NAME
mt - magnetic tape manipulating program SYNOPSIS
tapename] command [count] Obsolescent tapename] command [count] DESCRIPTION
is used to give commands to the tape drive. If tapename is not specified, the environment variable is used; if is not defined, the default drive is used. winds the tape in the requested direction (forward or backward), stopping after the specified count EOF marks or records are passed. If count is not specified, one is assumed. Each EOF mark counts as one record. When winding backwards, the tape always stops at the BOT marker, regardless of the number remaining in count. accepts the following commands: Write count EOF marks. Forward space count files. Forward space count records. Backward space count files. Backward space count records. Rewind tape. Rewind tape and go offline. Seek to end of data (DDS and QIC drives only). Write count setmarks (DDS drives only). Forward space count setmarks (DDS drives only). Backward space count setmarks (DDS drives only). Print status information about the tape drive. Reserve tape drive for sole use by the host issuing the command (stape or estape driver only). Release tape drive from sole use by the host issuing the command (stape or estape driver only). Spacing operations (back or forward space file or record) leave the tape positioned past the object being spaced to in the direction of motion. That is, backspacing a file leaves the the tape positioned before the file mark, forward spacing a file leaves the tape positioned after the file mark. This is consistent with all classical usage on tapes. WARNINGS
Only raw, no-rewind Berkeley-type devices should be specified. This type of device will not reposition the tape upon close. An example of such a device is or See mt(7) for more details. It is possible to wind the tape beyond the EOT marker and off the end of the reel. A reservation may only be cleared with a release by the host that issued the original reserve. In the event that the host that holds the reservation is no longer available, the command may be used to reclaim the device by issuing a bus device reset. See st(1M) for more details. The reserve/release functionality can only be issued to drives using the or driver. EXAMPLES
Rewind the tape associated with the device file or (if legacy DSF is disabled): FILES
Raw magnetic tape interface (stape) Raw magnetic tape interface (estape) Default tape interface. If legacy DSF is disabled, the default value is AUTHOR
was developed by the University of California, Berkeley. SEE ALSO
dd(1), st(1M), intro(7), mt(7). mt(1)
All times are GMT -4. The time now is 09:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy