find command and copying


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find command and copying
Prev   Next
# 1  
Old 03-12-2005
find command and copying

Trying to write a find command that will be used for incremental backups. Basically find files newer than date, and copy them (directory structures intact) to the backup drive. When I try the following:

Code:
find / -newer /home/robf/incremental -type f -exec cp -afP {} /backup/inc1 \;

It puts all the files in the one directory /backup/inc1 without preserving directories (i.e. all the files from the filesystem are lumped into the directory). Under RH 6.x this worked fine, but on the newer RHEL3 it just lumps them in one directory.

Any ideas/pointers for how best to accomplish this?

Rob
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Find command not executing for copying file

Buddies, I am trying to copy the file 'xcopyq' from /home/sandip to /home/sandip/testdir using the below command and getting the error as shown below:- sandip@manu:~$ find /home/sandip -type f -name '*xcopyq*' -exec cp{} /home/sandip/testdir/ \: find: missing argument to `-exec' Am I... (2 Replies)
Discussion started by: sandip250382
2 Replies

2. UNIX for Dummies Questions & Answers

Copying a command/line to clipboard

hi all, i am newbie to Unix scripting.. I am writing a script which will have a line of commands, which needs to be copied to clipboard. Any ideas welcome.. Usage:: I am using the script in this way, The script will have some lines (like below) export TERM=xterm; cd test_env; TMOUT=0 ... (1 Reply)
Discussion started by: gkarthik.gk
1 Replies

3. OS X (Apple)

Automated command ; extracting files from folders and copying them into a single folder

Hello everyone, I'm running Mac OS X Leopard (10.5.8) and I want to use the Terminal to help automate this tedious and laborious command for me: I need to extract all of the .m4p files in my "iTunes Music" folder which reside in folders of the artist, and then subfolders for the albums and... (2 Replies)
Discussion started by: qcom
2 Replies

4. Shell Programming and Scripting

Command for copying files without

Hi.. I have a file with same name in different locations which i need to copy. Am trying this cp -r /var/lib/text1 /backup In the /backup i have the same file called text1 so it's prompting for overwrite. Any opinions on how to avoid this prompting and copy files. Thanks in advance. (5 Replies)
Discussion started by: krthik
5 Replies

5. Shell Programming and Scripting

Find a directory and copying files to it

Hi all, wondering if someone would be able to help with a little query I have. I currently have a script which copies everything in a specific directory to a number of other directories depending on a variable. The problem I have is the destination directories vary (in and incoming directories)... (3 Replies)
Discussion started by: JayC89
3 Replies

6. UNIX for Dummies Questions & Answers

Using find -d and copying to the found directories

Hi again All :) After posting my first thread just a few eeks ago and having such a great response (Thank You once again :) ), I thought I'd perhaps ask the experts again. In short I'm trying to achieve a "find" and "copy" where the find needs to find directories: find -d -name outbox and... (6 Replies)
Discussion started by: Dean Rotherham
6 Replies

7. Shell Programming and Scripting

copying links/files using rsync command

Hi I am using rsync command to copy the likes like bwlow rsync -vaR krish/harris/test data/charles I am running this script in test1 folder but the krish/harssis /test is existed in test2 folder. So when i run this command am getting the error like rsync: link_stat... (1 Reply)
Discussion started by: KiranKumarKarre
1 Replies

8. UNIX for Dummies Questions & Answers

Using cp -r command to selectively omit *.dat files while copying a directory.

Hi all, I want to copy a directory named Ec1 to another directory named Ec2, newly created. But Ec1 has a bunch of *.dat files and many many other kinds of files. Whle creating Ec2, I selectively want to omit the *.dat files since they are huge files of the order of 100 MBs and there are... (5 Replies)
Discussion started by: d_sai_kumar
5 Replies

9. UNIX for Dummies Questions & Answers

Copying file names returned from a grep command into another directory

When I do the following : grep -l "string" *, I get a list of file names returned. Is there a way to copy the files returned from the list into another directory ?. Thanks. (4 Replies)
Discussion started by: Kartheg
4 Replies

10. Shell Programming and Scripting

command find returned bash: /usr/bin/find: Argument list too long

Hello, I create a file touch 1201093003 fichcomp and inside a repertory (which hava a lot of files) I want to list all files created before this file : find *.* \! -maxdepth 1 - newer fichcomp but this command returned bash: /usr/bin/find: Argument list too long but i make a filter all... (1 Reply)
Discussion started by: yacsil
1 Replies
Login or Register to Ask a Question
MV(1)									FSF								     MV(1)

NAME
mv - move (rename) files SYNOPSIS
mv [OPTION]... SOURCE DEST mv [OPTION]... SOURCE... DIRECTORY mv [OPTION]... --target-directory=DIRECTORY SOURCE... DESCRIPTION
Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY. Mandatory arguments to long options are mandatory for short options too. --backup[=CONTROL] make a backup of each existing destination file -b like --backup but does not accept an argument -f, --force do not prompt before overwriting equivalent to --reply=yes -i, --interactive prompt before overwrite equivalent to --reply=query --reply={yes,no,query} specify how to handle the prompt about an existing destination file --strip-trailing-slashes remove any trailing slashes from each SOURCE argument -S, --suffix=SUFFIX override the usual backup suffix --target-directory=DIRECTORY move all SOURCE arguments into DIRECTORY -u, --update move only when the SOURCE file is newer than the destination file or when the destination file is missing -v, --verbose explain what is being done --help display this help and exit --version output version information and exit The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX. The version control method may be selected via the --backup option or through the VERSION_CONTROL environment variable. Here are the values: none, off never make backups (even if --backup is given) numbered, t make numbered backups existing, nil numbered if numbered backups exist, simple otherwise simple, never always make simple backups AUTHOR
Written by Mike Parker, David MacKenzie, and Jim Meyering. REPORTING BUGS
Report bugs to <bug-coreutils@gnu.org>. COPYRIGHT
Copyright (C) 2002 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU- LAR PURPOSE. SEE ALSO
The full documentation for mv is maintained as a Texinfo manual. If the info and mv programs are properly installed at your site, the com- mand info mv should give you access to the complete manual. mv (coreutils) 4.5.3 February 2003 MV(1)