Sponsored Content
Top Forums Shell Programming and Scripting Copy files from input file with dir structure Post 302473147 by Franklin52 on Friday 19th of November 2010 04:50:17 AM
Old 11-19-2010
Check this first with the echo command, if it's correct you can use the cp command:
Code:
Source="/home/guest/source"
Dest="/home/guest/source/Dest/"

tr ' ' '\n' < ${Source}inputfile | while read file
do
  echo cp ${Source}${file} ${Dest}
#  cp ${Source}${file} ${Dest}
done

 

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
AD(1)                                                              Netatalk 2.2                                                              AD(1)

NAME
ad - Netatalk compatible UNIX file utility suite. SYNOPSIS
ad {ls | cp | mv | rm} [...] ad {-v | --version} DESCRIPTION
ad is a UNIX file utlity suite with Netatalk compatibity. AppleDouble files in .AppleDouble directories and the CNID databases are updated as appropiate. AVAILABLE COMMANDS
ad ls [-dRl [u]] {file|dir [...]} List files and directories. ad cp [-aipvf] {src_file} {dst_file} ad cp -R [-aipvf] {src_file|src_directory ...} {dst_directory} Copy files and directories. ad mv [-finv] {src_file} {dst_file} ad mv [-finv] {src_file|src_directory ...} {dst_directory} Move files and directories. ad rm [-Rv] {file|directory} ad -v|--version Show version. AD LS
List files and directories. Options: -d Directories are listed as plain files -R list subdirectories recursively -l Long output, list AFP info -u List UNIX info Long output description <unixinfo> <FinderFlags> <AFP Attributes> <Color> <Type> <Creator> <CNID from AppleDouble> <name> FinderFlags (valid for (f)iles and/or (d)irectories): d = On Desktop (f/d) e = Hidden extension (f/d) m = Shared (can run multiple times) (f) n = No INIT resources (f) i = Inited (f/d) c = Custom icon (f/d) t = Stationery (f) s = Name locked (f/d) b = Bundle (f/d) v = Invisible (f/d) a = Alias file (f/d) AFP Attributes: y = System (f/d) w = No write (f) p = Needs backup (f/d) r = No rename (f/d) l = No delete (f/d) o = No copy (f) Note: any letter appearing in uppercase means the flag is set but it's a directory for which the flag is not allowed. AD CP
Copy files and directories. In the first synopsis form, the cp utility copies the contents of the source_file to the target_file. In the second synopsis form, the contents of each named source_file is copied to the destination target_directory. The names of the files themselves are not changed. If cp detects an attempt to copy a file to itself, the copy will fail. Netatalk AFP volumes are detected by means of their ".AppleDesktop" directory which is located in their volume root. When a copy targetting an AFP volume is detected, its CNID database daemon is connected and all copies will also go through the CNID database. AppleDouble files are also copied and created as needed when the target is an AFP volume. Options: -a Archive mode. Same as -Rp. -f For each existing destination pathname, remove it and create a new file, without prompting for confirmation regardless of its permis- sions. (The -f option overrides any previous -i or -n options.) -i Cause cp to write a prompt to the standard error output before copying a file that would overwrite an existing file. If the response from the standard input begins with the character 'y' or 'Y', the file copy is attempted. (The -i option overrides any pre- vious -f or -n options.) -n Do not overwrite an existing file. (The -n option overrides any previous -f or -i options.) -p Cause cp to preserve the following attributes of each source file in the copy: modification time, access time, file flags, file mode, user ID, and group ID, as allowed by permissions. If the user ID and group ID cannot be preserved, no error message is displayed and the exit value is not altered. -R If source_file designates a directory, cp copies the directory and the entire subtree connected at that point.If the source_file ends in a /, the contents of the directory are copied rather than the directory itself. -v Cause cp to be verbose, showing files as they are copied. -x File system mount points are not traversed. AD MV
Move files and directories. Move files around within an AFP volume, updating the CNID database as needed. If either: o source or destination is not an AFP volume o source AFP volume != destination AFP volume the files are copied and removed from the source. Options: -f Do not prompt for confirmation before overwriting the destination path. (The -f option overrides any previous -i or -n options.) -i Cause mv to write a prompt to standard error before moving a file that would overwrite an existing file. If the response from the standard input begins with the character `y' or `Y', the move is attempted. (The -i option overrides any previous -f or -n options.) -n Do not overwrite an existing file. (The -n option overrides any previous -f or -i options.) -v Cause mv to be verbose, showing files after they are moved. AD RM
Remove files and directories. The rm utility attempts to remove the non-directory type files specified on the command line. If the files and directories reside on an AFP volume, the corresponding CNIDs are deleted from the volumes database. The options are as follows: -R Attempt to remove the file hierarchy rooted in each file argument. -v Be verbose when deleting files, showing them as they are removed. REPORTING BUGS
Report bugs to the Netatalk-devel list <netatalk-devel@lists.sourceforge.net>. SEE ALSO
dbd(1), apple_dump(1). Netatalk 2.2 02 Sep 2011 AD(1)
All times are GMT -4. The time now is 12:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy