Sponsored Content
Top Forums Shell Programming and Scripting Copy files from input file with dir structure Post 302473121 by dragon.1431 on Friday 19th of November 2010 02:43:33 AM
Old 11-19-2010
Hi Franklin,
Thanks a lot for your solutions.

it didn't work !!

Code:
#!/bin/bash
Source="/home/guest/source/"
Dest="/home/guest/source/Dest/"
tr ' ' '\n' < ${Source}input | while read file
do
  cp ${Source}${file} ${Dest}${file}
done

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

got error as follows:
Code:
cp: cannot create regular file `/home/guest/source/Dest//xyz/Test/testsrc.c': No such file or directory
cp: cannot create regular file `/home/guest/source/Dest//xyz/nmake/build.mak': No such file or directory
cp: cannot create regular file `/home/guest/source/Dest//abc/1.c': No such file or directory

tried removing forward slash at the beginning of input file!
input
Code:
xyz/Test/testsrc.c xyz/nmake/build.mak abc/1.c

error:
Code:
cp: cannot create regular file `/home/guest/source/Dest/xyz/Test/testsrc.c': No such file or directory
cp: cannot create regular file `/home/guest/source/Dest/xyz/nmake/build.mak': No such file or directory
cp: cannot create regular file `/home/guest/source/Dest/abc/1.c': No such file or directory

I have those input files in Source directory and i also have necessary permissions to write in Dest as well.

any idea ?

Last edited by dragon.1431; 11-19-2010 at 03:44 AM.. Reason: updated error info
 

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
BHYVELOAD(8)						    BSD System Manager's Manual 					      BHYVELOAD(8)

NAME
bhyveload -- load a FreeBSD guest inside a bhyve virtual machine SYNOPSIS
bhyveload [-c cons-dev] [-d disk-path] [-e name=value] [-h host-path] [-m mem-size] vmname DESCRIPTION
bhyveload is used to load a FreeBSD guest inside a bhyve(4) virtual machine. bhyveload is based on loader(8) and will present an interface identical to the FreeBSD loader on the user's terminal. The virtual machine is identified as vmname and will be created if it does not already exist. OPTIONS
The following options are available: -c cons-dev cons-dev is a tty(4) device to use for bhyveload terminal I/O. The text string "stdio" is also accepted and selects the use of unbuffered standard I/O. This is the default value. -d disk-path The disk-path is the pathname of the guest's boot disk image. -e name=value Set the FreeBSD loader environment variable name to value. The option may be used more than once to set more than one environment variable. -h host-path The host-path is the directory at the top of the guest's boot filesystem. -m mem-size [K|k|M|m|G|g|T|t] mem-size is the amount of memory allocated to the guest. The mem-size argument may be suffixed with one of K, M, G or T (either upper or lower case) to indicate a multiple of Kilobytes, Megabytes, Gigabytes or Terabytes respectively. The default value of mem-size is 256M. EXAMPLES
To create a virtual machine named freebsd-vm that boots off the ISO image /freebsd/release.iso and has 1GB memory allocated to it: bhyveload -m 1G -d /freebsd/release.iso freebsd-vm To create a virtual machine named test-vm with 256MB of memory allocated, the guest root filesystem under the host directory /user/images/test and terminal I/O sent to the nmdm(4) device /dev/nmdm1B bhyveload -m 256MB -h /usr/images/test -c /dev/nmdm1B test-vm SEE ALSO
bhyve(4), nmdm(4), vmm(4), bhyve(8), loader(8) HISTORY
bhyveload first appeared in FreeBSD 10.0, and was developed at NetApp Inc. AUTHORS
bhyveload was developed by Neel Natu <neel@FreeBSD.org> at NetApp Inc with a lot of help from Doug Rabson <dfr@FreeBSD.org>. BUGS
bhyveload can only load FreeBSD as a guest. BSD
January 7, 2012 BSD
All times are GMT -4. The time now is 06:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy