Sponsored Content
Top Forums Shell Programming and Scripting Copy files from input file with dir structure Post 302472747 by dragon.1431 on Thursday 18th of November 2010 03:12:03 AM
Old 11-18-2010
MySQL Copy files from input file with dir structure

hi,

I want to copy files from source directory based on input file (or output of previous command) and i want to have the SAME DIRECTORY STRUCTURE.
Note that i will have other files and directories which i dont want to copy to destination.

For example, dir source has following content:
Code:
/xyz/Test/testsrc.c /xyz/nmake/build.mak /abc/1.c /abc/1.h ../proj_src/2.c ../proj_src/2.h /abc/svn/.svn  xyz/dump/dump.log

input file contains:
Code:
/xyz/Test/testsrc.c /xyz/nmake/build.mak /abc/1.c

first i split fields in to new line using awk , make a substitution with sed.
right now i am able to copy all the files to destination directory to read from file using while loop but i dont get the files as per dir structure.

Actual output:
Code:
Dest/testsrc.c Dest/build.mak Dest/1.c

Expected output:
Code:
Dest/xyz/Test/testsrc.c Dest/xyz/nmake/build.mak Dest/abc/1.c

I appreciate your help.

Last edited by dragon.1431; 11-18-2010 at 04:13 AM.. Reason: actual output info added
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to copy N files from one dir to another

Hi, I have a script that can only handLE limited number of input files. I need to be able to write a command (or a script) that: 1> copies N number of files from one directory (A) to another (B). 2> Files that are moved need to be renamed. 3> Files picked to be moved have... (1 Reply)
Discussion started by: GMMike
1 Replies

2. UNIX for Dummies Questions & Answers

copy files with directory structure

i have a text file as. /database/sp/NTR_Update_Imsi_List.sql /database/sp/NTR_Update_Imsi_Range_List.sql /database/sp/NTR_Vlr_Upload.sql /database/tables/StatsTables.sql /mib/ntr.mib /mib/ntr.v2.mib /scripts/operations/ntr/IMSITracer.ph /scripts/operations/ntr/IMSITracer.pl ... (3 Replies)
Discussion started by: adddy
3 Replies

3. Shell Programming and Scripting

copy files from one dir to another

Hi , I want to copy files from one dir to anothe dir and check if destination dir exists ,if not exist ,has to create but when executing the below schell script ,the destination directory not exist and exit the shell script. #!/bin/sh src_path=/home/owngdw/abc tgt_path=/home/owngdw/abc/xyz if... (6 Replies)
Discussion started by: mohan705
6 Replies

4. Shell Programming and Scripting

How to copy specified files from list of files from dir A to dir B

Hello, fjalkdsjfkldsajflkajdskl (3 Replies)
Discussion started by: pmeesara
3 Replies

5. Shell Programming and Scripting

Script to run a command on all txt files present in a dir structure

Hi, I have a directory structure like the one given below root\a\b1 root\a\b2 root\b\b1 root\b\b2 . . . root\j\b1 root\j\b2 Now, there are a txt files in each dir and subdir, there is a root.txt I have to write a script where in i have to run a command called "genrb <filename>"... (6 Replies)
Discussion started by: vikramsinghnegi
6 Replies

6. Shell Programming and Scripting

Copy Files to Dir and Check If File Exists

Hi everyone. I am trying to write a bash script that will copy files from one directory to another but I need to be able to check the directory that I'm copying the files to and see if the file already exists. If it does I need to add a number at the end of the copied file. Thanks for your help. (3 Replies)
Discussion started by: snag49ers
3 Replies

7. Shell Programming and Scripting

shell script to take input from a text file and perform check on each servers and copy files

HI all, I want to script where all the server names will be in a text file like server1 server2 server3 . and the script should take servernames from a text file and perform copy of files if the files are not present on those servers.after which it should take next servername till the end of... (0 Replies)
Discussion started by: joseph.dmello
0 Replies

8. Shell Programming and Scripting

Copy files and subdirs from dir to a new dir

Hello Comunity I am trying to make a bash shell script that it copies files and subdirs(with files) to a new dir. I would like the dest_dir to contain only subdirectories with files not other subdirs inside. it called : cpflatdir src_dir dest_dir Pleaze help me! Thank you in... (2 Replies)
Discussion started by: BTKBaaMMM
2 Replies

9. Shell Programming and Scripting

files copy to dir

Hi, I have a directory which is having many files. I want to copy 10files at a time to another directory. For example. First 10 files to one directory, then next 10 files to another directory and so on. Please let me know if any work around there for it. Thanks (4 Replies)
Discussion started by: Anjan1
4 Replies

10. Shell Programming and Scripting

Copying files to new dir structure.

I am trying to figure out a way to script copying specific files from one dir structure to another. I have a dir structure like this: dira/author 1/book 1/file a.epub /book 2/file b.epub /author 2/book 1/file c.epub /author 3/book 1/file d.epub /book 2/file... (2 Replies)
Discussion started by: arcanas
2 Replies
uuto(1C)						      Communication Commands							  uuto(1C)

NAME
uuto, uupick - public UNIX-to-UNIX system file copy SYNOPSIS
uuto [-mp] source-file... destination uupick [-s system] DESCRIPTION
uuto uuto sends source-file to destination. uuto uses the uucp(1C) facility to send files, while it allows the local system to control the file access. A source-file name is a path name on your machine. Destination has the form: system[!system] ... !user where system is taken from a list of system names that uucp knows about. User is the login name of someone on the specified system. The files (or sub-trees if directories are specified) are sent to PUBDIR on system, where PUBDIR is a public directory defined in the uucp source. By default, this directory is /var/spool/uucppublic. Specifically the files are sent to PUBDIR/receive/user/mysystem/files. The recipient is notified by mail(1) of the arrival of files. uupick uupick accepts or rejects the files transmitted to the user. Specifically, uupick searches PUBDIR for files destined for the user. For each entry (file or directory) found, the following message is printed on standard output: from system sysname: [file file-name] [dir dirname] ? uupick then reads a line from standard input to determine the disposition of the file: <new-line> Go to next entry. d Delete the entry. m [ dir ] Move the entry to named directory dir. If dir is not specified as a complete path name (in which $HOME is legiti- mate), a destination relative to the current directory is assumed. If no destination is given, the default is the current directory. a [ dir ] Same as m above, except it moves all the files sent from system. p Print the content of the file. q Stop. EOT (control-d) Same as q. !command Escape to the shell to do command. * Print a command summary. OPTIONS
uuto The following options are supported by uuto: -m Send mail to the sender when the copy is complete. -p Copy the source file into the spool directory before transmission. uupick The following option is supported by uupick: -s system Search only the PUBDIR for files sent from system. OPERANDS
The following operands are supported for uuto: destination A string of the form: system-name!user where system-name is taken from a list of system names that uucp knows about; see uuname. The argument user is the login name of someone on the specified system. The destination system-name can also be a list of names such as system-name!system-name!... !system-name!user in which case, an attempt is made to send the file via the specified route to the destination. Care should be taken to ensure that intermediate nodes in the route are willing to forward information. source-file A pathname of a file on the local system to be copied to destination. ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of uuto and uupick: LC_TYPE, LC_MESSAGES, and NLSPATH. EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 An error occurred. FILES
PUBDIR /var/spool/uucppublic public directory ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWbnuu | +-----------------------------+-----------------------------+ SEE ALSO
mail(1), uucp(1C), uustat(1C), uux(1C), uucleanup(1M), attributes( 5) NOTES
In order to send files that begin with a dot (for instance, .profile), the files must be qualified with a dot. For example, the following files are correct: .profile .prof* .profil? The following files are incorrect: *prof* ?profile SunOS 5.10 28 Mar 1995 uuto(1C)
All times are GMT -4. The time now is 06:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy