Sponsored Content
Operating Systems HP-UX Copy only files whiich do not exist on Target Directory Post 302377067 by Chetanaz on Thursday 3rd of December 2009 04:08:36 AM
Old 12-03-2009
Hi Daptal

Many Thanks for the reply

The option you suggested works.
However I am not sure if it will ipmact the performance, since the (exists) test will be carried for each file individually

This is like -exec
Do we have any option like xargs which will execute only once for this?

Initially I thought of 'diff' for comparing the files in directories but it compare contents of the files as well which is not feasible in my case since I have binary files of quite big size

These are Oracle archivelog files, each 150-200 Mb and large number of quantity

Also I tried following which too is slow

ls -ltr dir1>dir1FileList.txt
ls -ltr dir2>dir2FileList.txt
diff dir1FileList.txt dir2FileList.txt|awk '{print $9}'>reqdFiles.txt

Thanks and Regards,
Chetana
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copy files from one directory to another

I need to copy about 13 Tb of data from one directory and subdirectories to the other (another mount point). If I run this as a cron, say between 10 pm and 7 am, not all of the files will be copied over. Is there a way of 'resuming' the copy the following evenings until all files are copied over? (0 Replies)
Discussion started by: hd2006
0 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. Shell Programming and Scripting

Check if certain files exist in a directory, if not add name to a textfile

We recieve some logs on our windows box via FTP on a daily basis, in the same directory. I would like to check for missing logs files and add their name to a text file. Something like... Check if C:\logs\file1_currentdate exists (if not, add file1_currentdate to... (1 Reply)
Discussion started by: SunnyK
1 Replies

4. Shell Programming and Scripting

copy files from remote server (B) to target server (A)?

Hi All, what is the comand to log off the remote server? I have 2 servers A, B. I need to find all files older than 7 days on server B and copy over to server A. My logic is: login the remote server: ================= ssh hostB cd /data/test find . -mtime -7 -ls | awk '{print... (4 Replies)
Discussion started by: Beginer0705
4 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. 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

7. UNIX for Dummies Questions & Answers

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. I want to copy all the files across which are on TVbackup but are not currently on TV. If there is a file with the same name but a... (2 Replies)
Discussion started by: Spadez
2 Replies

8. Shell Programming and Scripting

Copy the files in directory and sub folders as it is to another directory.

How to copy files from one directory to another directory with the subfolders copied. If i have folder1/sub1/sub2/* it needs to copy files to folder2/sub1/sub2/*. I do not want to create sub folders in folder2. Can copy command create them automatically? I tried cp -a and cp -R but did... (4 Replies)
Discussion started by: santosh2626
4 Replies

9. Post Here to Contact Site Administrators and Moderators

How to count successfully copy files source to target location with check directory in Linux?

Hi guys...please any one help me .... how to copy files from source to target location if 5 files copied successfully out of 10 files then implement success=10 and if remaining 5 files not copied successfully then count error=5 how to implement this condition with in loop i need code linux... (0 Replies)
Discussion started by: sravanreddy
0 Replies

10. Shell Programming and Scripting

Shell scripting for moving folder specific files into target directory of that country folder.

I need help to write shell script to copy files from one server to another server. Source Directory UAE(inside i have another folder Misc with files inside UAE folder).I have to copy this to another server UAE folder( Files should be copied to UAE folder and Misc files should be copied in target... (3 Replies)
Discussion started by: naresh2389
3 Replies
INSTALL(1)						    BSD General Commands Manual 						INSTALL(1)

NAME
install -- install binaries SYNOPSIS
install [-bCcMpSsv] [-B suffix] [-f flags] [-g group] [-m mode] [-o owner] file1 file2 install [-bCcMpSsv] [-B suffix] [-f flags] [-g group] [-m mode] [-o owner] file1 ... fileN directory install -d [-v] [-g group] [-m mode] [-o owner] directory ... DESCRIPTION
The file(s) are copied to the target file or directory. If the destination is a directory, then the file is copied into directory with its original filename. If the target file already exists, it is either renamed to file.old if the -b option is given or overwritten if permis- sions allow. An alternate backup suffix may be specified via the -B option's argument. The options are as follows: -B suffix Use suffix as the backup suffix if -b is given. -b Back up any existing files before overwriting them by renaming them to file.old. See -B for specifying a different backup suffix. -C Copy the file. If the target file already exists and the files are the same, then don't change the modification time of the target. -c Copy the file. This is actually the default. The -c option is only included for backwards compatibility. -d Create directories. Missing parent directories are created as required. -f Specify the target's file flags; see chflags(1) for a list of possible flags and their meanings. -g Specify a group. A numeric GID is allowed. -M Disable all use of mmap(2). -m Specify an alternate mode. The default mode is set to rwxr-xr-x (0755). The specified mode may be either an octal or symbolic value; see chmod(1) for a description of possible mode values. -o Specify an owner. A numeric UID is allowed. -p Preserve the modification time. Copy the file, as if the -C (compare and copy) option is specified, except if the target file doesn't already exist or is different, then preserve the modification time of the file. -S Safe copy. Normally, install unlinks an existing target before installing the new file. With the -S flag a temporary file is used and then renamed to be the target. The reason this is safer is that if the copy or rename fails, the existing target is left untouched. -s install exec's the command strip(1) to strip binaries so that install can be portable over a large number of systems and binary types. -v Causes install to show when -C actually installs something. By default, install preserves all file flags, with the exception of the ``nodump'' flag. The install utility attempts to prevent moving a file onto itself. Installing /dev/null creates an empty file. DIAGNOSTICS
The install utility exits 0 on success, and 1 otherwise. FILES
INS@XXXX If either -S option is specified, or the -C or -p option is used in conjuction with the -s option, temporary files named INS@XXXX, where XXXX is decided by mkstemp(3), are created in the target directory. COMPATIBILITY
Historically install moved files by default. The default was changed to copy in FreeBSD 4.4. SEE ALSO
chflags(1), chgrp(1), chmod(1), cp(1), mv(1), strip(1), mmap(2), chown(8) HISTORY
The install utility appeared in 4.2BSD. BUGS
Temporary files may be left in the target directory if install exits abnormally. File flags cannot be set by fchflags(2) over a NFS file system. Other file systems do not have a concept of flags. install will only warn when flags could not be set on a file system that does not support them. install with -v falsely says a file is copied when -C snaps hard links. BSD
May 7, 2001 BSD
All times are GMT -4. The time now is 04:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy