copy only new files or files of a different size


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers copy only new files or files of a different size
# 1  
Old 05-15-2009
copy only new files or files of a different size

hello

i would like to copy files from 1 location to a nother, but it has only to copy files which are newer or have a different filesize.
all has to be logged to a copy.log file (als skipped files should be in the log)

is this possible with the cp command
# 2  
Old 05-15-2009
You can consider to use cpio with find. An example to copy the files of the current and underlying directories to /dest/dir:

find * -print | cpio -vm /dest/dir

Read the man pages of both commands for more options.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Files by size

I am new to Unix and need help. I have several files of different sizes Example: 1 GB , 2GB , 500 mb ,200mb and even small sizes. What I want is I want to pick files and sum of the combined file size should be less than 3 Gb and move them to a different directory. when I do ls -ltr I want to pcik... (1 Reply)
Discussion started by: pyarigreat
1 Replies

2. Shell Programming and Scripting

Locate the files in the first column and copy the files in 2nd column

#cat data.txt file1 folder1 file2 thisforfile2 file3 thisfolderforfile3 lata4 folder4 step 1: create the folder first in column 2 for i in `awk '{print $2}' data.txt` do mkdir /home/data/$i done step 2: locate the files in column1 and stored them into a file for i in... (17 Replies)
Discussion started by: kenshinhimura
17 Replies

3. UNIX for Dummies Questions & Answers

Copy files from one drive to another, keeping most recently modified files

Hi all, I am a bit of a beginner with shell scripting.. What I want to do is merge two drives, for example moving all data from X to Y. If a file in X doesn't exist in Y, it will be moved there. If a file in X also exists in Y, the most recently modified file will be moved to (or kept) in... (5 Replies)
Discussion started by: apocolapse
5 Replies

4. Shell Programming and Scripting

Files have same size

Hello, I want remove files have same size in a directory. this command only find this files. ls -l | awk '$1!~/^d/{if(size!=""){ print}size=$8}' I want to remove the files of the same size. samples: 5 files are same size. I want to keep only first file. Thank you very much for your help. (3 Replies)
Discussion started by: hoo
3 Replies

5. Red Hat

Unable to copy files due to many files in directory

I have directory that has some billion file inside , i tried copy some files for specific date but it's always did not respond for long time and did not give any result.. i tried everything with find command and also with xargs.. even this command find . -mtime -2 -print | xargs ls -d did not... (2 Replies)
Discussion started by: before4
2 Replies

6. Shell Programming and Scripting

how to copy files followed by list of names of all the files in /etc?

....... (2 Replies)
Discussion started by: pcbuilder
2 Replies

7. Solaris

How to safely copy full filesystems with large files (10Gb files)

Hello everyone. Need some help copying a filesystem. The situation is this: I have an oracle DB mounted on /u01 and need to copy it to /u02. /u01 is 500 Gb and /u02 is 300 Gb. The size used on /u01 is 187 Gb. This is running on solaris 9 and both filesystems are UFS. I have tried to do it using:... (14 Replies)
Discussion started by: dragonov7
14 Replies

8. Shell Programming and Scripting

Merge files of differrent size with one field common in both files using awk

hi, i am facing a problem in merging two files using awk, the problem is as stated below, file1: A|B|C|D|E|F|G|H|I|1 M|N|O|P|Q|R|S|T|U|2 AA|BB|CC|DD|EE|FF|GG|HH|II|1 .... .... .... file2 : 1|Mn|op|qr (2 Replies)
Discussion started by: shashi1982
2 Replies

9. Shell Programming and Scripting

This script cut size of files "Lol" change string in files

Basic: find . -type f -name “*.txt” -print | awk '{gsub("Ontem", "AntesdeOntem", $0); print > FILENAME}' *.txt The idea is in folder /home/myapontamentos I have some files and i need to change in all them the word "ontem" to "antesdeontem". But bigger files are cut (size i mean)... (4 Replies)
Discussion started by: single
4 Replies

10. Shell Programming and Scripting

bash script working for small size files but not for big size files.

Hi, I have one file stat. Stat file contents are as follows: for example. H50768020040913,00260100,507680,13,0000000643,0000000643,00000,0000 H50769520040808,00260100,507695,13,0000000000,0000000000,00000,0000 H50770620040611,00260100,507706,13,0000000000,0000000000,00000,0000 Now i... (1 Reply)
Discussion started by: davidpreml
1 Replies
Login or Register to Ask a Question