Sponsored Content
Top Forums Shell Programming and Scripting Continuous Copying from a directory to another. Post 303006748 by sadique.manzar on Tuesday 7th of November 2017 09:23:54 AM
Old 11-07-2017
Dear Hicksd8,

First of all nice question.
  • What about files that get modified? Do you want to copy them too? Or do files in this directory never get modified?
    Never get modified, its like fly here and then from here to different server.
    .
  • What about files that are still being written to/created? Do you want to copy these incomplete files regardless?
    While incomplete the extension name is .temp, so my script is simply ruling them out.
    .
  • What lag in the copying can you tolerate? If a cron job ran every 5 minutes would that suffice? If you are trying to mirror in real-time then some mirroring suite would probably do the job better.
    As I said, files fly from this server to other. so running every 5 mins may miss files.



Regards,
Sadique

Last edited by rbatte1; 11-07-2017 at 11:06 AM.. Reason: Clearer formatting of response to questions
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Problems with Copying Directory

Hi, i'm completely new to Unix. I'm trying to copy my "Pictures" folder, and all the folders under it, to a different folder "Photos". So say "Pictures" has a sub folder "2". what happens is "2" is copied to "Photos" like i want it to, but then a sub directory "tmp2" is made which... (3 Replies)
Discussion started by: brudnerx
3 Replies

2. UNIX for Dummies Questions & Answers

copying a file from one directory to another

Hi This is my first day in Unix, and I am trying to copy a file called holiday.txt from my D drive into the C drive folder called h like currently i am in D drive, i want to copy my holiday.txt into C\h (C drive, h folder) i am able to copy the file in the same drive, but how to do the... (5 Replies)
Discussion started by: soujanya_srk
5 Replies

3. UNIX for Dummies Questions & Answers

Copying with directory structure

Hi, I need to copy a set of directories along with all sub directories and files from one unix box to another. Any ideas? cnfsed (4 Replies)
Discussion started by: Cnfsed
4 Replies

4. UNIX for Dummies Questions & Answers

Copying files from one directory to Other

Hi UNIX Gurus, Could please help me out regarding following situation. I am copying some files from one directory to other directotry using following command. cp /var/tmp/*date*.gz /var/tmp/user/ Problem: Once the copy has completed, I need to check whether all the files (including... (3 Replies)
Discussion started by: satishkeshetty
3 Replies

5. UNIX for Dummies Questions & Answers

Copying one file at a time from one directory to another directory.

Hi All i want to write a script which could copy one file at a time from one directory to another directory. Scenerio: Let's say i have 100 file in a dirctory,so i want to copy one file at a time to another directory with a sleep statement in between that of 30 secs. please help me... (1 Reply)
Discussion started by: Nikhilindurkar
1 Replies

6. Shell Programming and Scripting

Copying curent directory

I am trying to write a script that first copies all the directories and files from the current directory into a new Directory. I get and error "Cannot copy directory into itself". That's fine. I don't want it to. What I am worried about is when I give this script to my company (they are using a... (2 Replies)
Discussion started by: Fred Goldman
2 Replies

7. Shell Programming and Scripting

Copying files from one directory into another.

Could someone please tell me if there is a command similar to head or tail that can be used on directories. I want to select a given number of files from a directory and copy them into another directory. But I found out I can't use head as it doesn't (or I don't know how yet!) work on directories.... (4 Replies)
Discussion started by: Krush187
4 Replies

8. Shell Programming and Scripting

Copying files to a directory

Hi I have a few questions. I am trying to copy a file to a directory. I need to copy files that do not end in numbers, for example, into a directory. This is what I tried so far. cp filename directorytowhereIwannacopy but it says it can't copy to a directory. I need to copy many files into one... (2 Replies)
Discussion started by: #moveon
2 Replies

9. Shell Programming and Scripting

Copying subdirectories of a directory to some other directory and renaming them

Hi, I am a newbie in shell scripting. I have to copy a particular sub-directory (data) from a large no. of directories (all in the same folder) and paste them to another directory ( /home/hubble/data ) and then rename all the subdirectories (data) as the name of its parent directory. please... (8 Replies)
Discussion started by: sholay
8 Replies

10. Shell Programming and Scripting

Copying files to a directory

Hi, I am newbie to unix scripting, need a help in the doubt i have. It is " when files are copied to a directory using cp command, they are arranged by default according to the file name, is there anyway where the files that are copied be arranged with respect to their size, with using the sort... (5 Replies)
Discussion started by: pundalik
5 Replies
lifcp(1)						      General Commands Manual							  lifcp(1)

NAME
lifcp - copy to or from LIF files SYNOPSIS
xxx] xxx] xxx] xxx] file1 file2 xxx] xxx] xxx] xxx] [file1 file2 ...] directory DESCRIPTION
copies a LIF file to an HP-UX file, an HP-UX file to a LIF file, or a LIF file to another LIF file. It also copies a list of (HP-UX/LIF) files to a (LIF/HP-UX) directory. The last name on the argument list is the destination file or directory. Options The space between option and argument is optional. Used only when copying files to a LIF volume. This option forces the file type of the LIF directory entry to be set to the argument given. The argument can be decimal, octal or hex, using standard C notation. Used only when copying files to a LIF volume. This option will set the "last volume flag" to xxx (0 or 1). The default "last volume flag" is Used only when copying files to a LIF volume. This option sets the "volume number" to xxx. The default "volume number" is one. This option forces a ASCII mode of copying regardless of the file type. When copying in ASCII mode from HP-UX to LIF the default file type is BINARY (1). (For details on available modes of copying refer to lif(4)). This option has no effect when copying from LIF to LIF. This option forces a BINARY mode of copying regardless of the file type. When copying in BINARY mode from HP-UX to LIF the default file type is BINARY (-2). (For details on available modes of copying refer to lif(4)). This option has no effect when copying from LIF to LIF. Used only when copying files to a LIF volume. This option sets the "implementation" field of the LIF directory entry to the argument given. The argument value can be decimal, octal or hex, using standard C notation. The "implementation" field can only be set for file types -2001 to -100000 (octal). The "implementation" field is set to zero for all interchange file types and for file types -2 to -200 (octal). Note that the "implementation" value controls the attributes of the LIF file with regard to protection and record sizes. or can be used to determine the "implementation" value of a file. Forces RAW mode copying regardless of file type. When copying in RAW mode from HP-UX to LIF the default file type is BIN (-23951). option overrides the default file type. (various modes of copying are explained in lif(4).) The option has no effect in LIF to LIF copy operations. causes HP-UX file names to be translated to a name acceptable by a LIF utility; that is, all lowercase letters are converted to uppercase and all other characters except numerics are changed to an underscore If the HP-UX file name starts with a nonletter, the file name is preceded by the capital letter Thus, for example, if two files named colon and semicolon were copied, both of them would be translated to File names are truncated to a maximum of 10 characters. When copying a LIF file to an HP-UX or LIF file, has no effect. Omitting causes an error to be generated if an improper name is used. The default copying modes when copying from LIF to HP-UX are summarized in the following table: | File Type | Default Copying Mode ----------+---------------------- ASCII | ASCII BINARY | BINARY BIN | RAW other | RAW When copying from HP-UX to LIF, the default copying mode is ASCII and an ASCII file is created. When copying from LIF to LIF, if no options are specified, then all the LIF directory fields and file contents are duplicated from source to destination. A LIF file name is recognized by the embedded colon delimiter (see lif(4) for LIF file naming conventions). A LIF directory is recognized by a trailing colon. If an HP-UX file name containing a colon is used, the colon must be escaped with two backslash characters (the shell removes one of them). The file name (dash) is interpreted to mean standard input or standard output, depending on its position in the argument list. This is particularly useful if the data requires nonstandard translation. When copying from standard input, if no other name can be found, the name "STDIN" is used. LIF file naming conventions are known only to the LIF utilities. Since file name expansion is done by the shell, this mechanism cannot be used for expanding LIF file names. Do not mount the special file while using DIAGNOSTICS
returns exit code 0 if the file is copied successfully. Otherwise it prints a diagnostic and returns nonzero. EXAMPLES
Copy HP-UX file to LIF file on LIF volume which is actually an HP-UX file initialized to be a LIF volume: Copy all the HP-UX files in the current directory to the LIF volume which is present in the parent directory. File names are translated to appropriate LIF file names. Copy all the HP-UX object files in the current directory to the LIF volume lifvol. Copying mode is RAW and LIF file types are set to -5555. Copy all the object files in the current directory to the LIF volume Copying mode is BINARY and LIF BINARY files are created. Copy a BDAT file, without a password, from a BASIC WorkStation to an HP-UX LIF volume Note that controls protection and record size attributes. The file type for a BDAT file is -5791 (or 0xffffe961) and its record size is 256 bytes per record. Copy all files in the current directory to the LIF volume in the directory. Copying mode is RAW and LIF file types are set to BIN. Copy file to LIF file in Copy files and to LIF files and within Copy LIF file within to file within current directory. Copy standard input to LIF file on LIF volume Copy LIF file in to LIF file on Copy the output of pr to the LIF file Copy the output of pr to the LIF volume LIF file is created since no file names are specified. Copy LIF file in to standard output. Copy all files in current directory to LIF files of the same name on LIF volume (may cause errors if file names in the current directory do not obey LIF naming conventions!). DEPENDENCIES
Series 700/800 The following option is also supported: forces each file copied in to begin on an nnn x 1024-byte boundary from the beginning of the volume. This is useful when files are used for Series 700/800 boot media. This option has no effect when copying from a LIF volume. AUTHOR
was developed by the Hewlett-Packard Company. SEE ALSO
lifinit(1), lifls(1), lifrename(1), lifrm(1), lif(4). lifcp(1)
All times are GMT -4. The time now is 05:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy