Sponsored Content
Top Forums Shell Programming and Scripting Issue with copying files into dir inside for loop Post 302858635 by smile689 on Tuesday 1st of October 2013 03:22:49 AM
Old 10-01-2013
Issue with copying files into dir inside for loop

Hi ,
I'm trying to move/copy the files inside the loop into a directory .
I tried the below code and the issue is the data is not copying into the created directory but the files are copying into another file

Code:
file_path="/home/etc"
 Last_Day=20130930
 
mkdir $file_path/ARC_${Last_Day}
 
  for files in $file_path/AB*$Last_Day*
  do 
    dest_dir=$ARC_${Last_Day}
    cp $file_path/$Last_Data $file_path/$dest_dir
 
   done

When i check with set -x the last cp command is interpreted as
cp /home/etc/AB_20130930.log /home/etc/20130930

Please suggest.. Thank You
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

copying a file from one dir to another dir

hi i have a script compareFiles() { find /tmp/Satya -type f | \ while read filename1 do echo "----------------------------------------$filename1" find /tmp/Satya -type f | \ while read filename2 do if diff $filename1 $filename2 then echo "Both files... (3 Replies)
Discussion started by: Satyak
3 Replies

2. Shell Programming and Scripting

copying files to new dir

Hello, I'm new to shell scripting so I don't really understand what I'm doing wrong. The script I'm trying to do saves all the files (*.c) on the current dir to a list and, one by one, copies them to a new one called Backup. The thing is, if there are already other versions of the files I'm... (6 Replies)
Discussion started by: G3nn
6 Replies

3. UNIX for Advanced & Expert Users

copying of files by userB, dir & files owned by userA

I am userB and have a dir /temp1 This dir is owned by me. How do I recursively copy files from another users's dir userA? I need to preserve the original user who created files, original group information, original create date, mod date etc. I tried cp -pr /home/userA/* . ... (2 Replies)
Discussion started by: Hangman2
2 Replies

4. UNIX for Dummies Questions & Answers

Permissions issue after copying files

Hi everyone, I am using mac os x 10.6, and I just copied over a project from a machine with 10.5... And I noticed my ls color is very funky in this directory... I found that my permissions are all messed up, and am wondering if there is a way to recursively fix permissions? This is how they... (3 Replies)
Discussion started by: patrick99e99
3 Replies

5. Shell Programming and Scripting

Copying specific files from one dir to another

Hi Folks, I have one curious case. There are list of following files placed in one directory such as... And updated each month. files.JAN09.csv files.FEB09.csv files.MAR09.csv ..... Now, I need to move a specific files; i.e, For this month, I need to move only OCT09, NOV09, DEC09,... (1 Reply)
Discussion started by: Jerald Nathan
1 Replies

6. Shell Programming and Scripting

issue while copying file dynamically whith in loop?

I need to copy the log file dynamically and that should run in loop , which means it should pick what ever the latest file is updated in that directory. I am able to display the list and copy to directly but i have no idea on how to pick the dynamically updated files. when i use this code, i... (1 Reply)
Discussion started by: johninweb
1 Replies

7. 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

8. Shell Programming and Scripting

Issue with copying files

Hi I have to write a shell script which copy files from one folder to another. When I try to do it directly from command prompt cp filename.dat /outgoing/filename.dat its working fine. But when I put the same command inside a shell script say test.sh its not getting copied. and when I check $?... (3 Replies)
Discussion started by: ravinunna
3 Replies

9. Shell Programming and Scripting

Issue with accessing value inside while loop, outside it

Hi, GetName() { if then echo " Please enter the name: " read Name tempvar=0 while read line do if then tempvar=`expr $tempvar + 1` echo $tempvar ... (10 Replies)
Discussion started by: rituparna_gupta
10 Replies

10. Shell Programming and Scripting

PERL - Copying ONLY files from one dir to another

I'm writing a Perl script which has its 1st step as to copy files from one directory to another directory. The Source directory has got files with extension, without extension, directories etc. But I want to copy ONLY files with no extension. The files with extensions and directories should not get... (2 Replies)
Discussion started by: jhamaks
2 Replies
S3QLCP(1)							       S3QL								 S3QLCP(1)

NAME
s3qlcp - Copy-on-write replication on S3QL file systems SYNOPSIS
s3qlcp [options] <source-dir> <dest-dir> DESCRIPTION
S3QL is a file system for online data storage. Before using S3QL, make sure to consult the full documentation (rather than just the man pages which only briefly document the available userspace commands). The s3qlcp command duplicates the directory tree source-dir into dest-dir without physically copying the file contents. Both source and destination must lie inside the same S3QL file system. The replication will not take any additional space. Only if one of directories is modified later on, the modified data will take additional storage space. s3qlcp can only be called by the user that mounted the file system and (if the file system was mounted with --allow-other or --allow-root) the root user. This limitation might be removed in the future (see issue 155). Note that: o After the replication, both source and target directory will still be completely ordinary directories. You can regard <src> as a snapshot of <target> or vice versa. However, the most common usage of s3qlcp is to regularly duplicate the same source directory, say documents, to different target directories. For a e.g. monthly replication, the target directories would typically be named something like docu- ments_January for the replication in January, documents_February for the replication in February etc. In this case it is clear that the target directories should be regarded as snapshots of the source directory. o Exactly the same effect could be achieved by an ordinary copy program like cp -a. However, this procedure would be orders of magnitude slower, because cp would have to read every file completely (so that S3QL had to fetch all the data over the network from the backend) before writing them into the destination folder. Snapshotting vs Hardlinking Snapshot support in S3QL is inspired by the hardlinking feature that is offered by programs like rsync or storeBackup. These programs can create a hardlink instead of copying a file if an identical file already exists in the backup. However, using hardlinks has two large dis- advantages: o backups and restores always have to be made with a special program that takes care of the hardlinking. The backup must not be touched by any other programs (they may make changes that inadvertently affect other hardlinked files) o special care needs to be taken to handle files which are already hardlinked (the restore program needs to know that the hardlink was not just introduced by the backup program to safe space) S3QL snapshots do not have these problems, and they can be used with any backup program. OPTIONS
The s3qlcp command accepts the following options: --debug activate debugging output --quiet be really quiet --version just print program version and exit EXIT STATUS
s3qlcp returns exit code 0 if the operation succeeded and 1 if some error occurred. SEE ALSO
The S3QL homepage is at http://code.google.com/p/s3ql/. The full S3QL documentation should also be installed somewhere on your system, common locations are /usr/share/doc/s3ql or /usr/local/doc/s3ql. COPYRIGHT
2008-2011, Nikolaus Rath 1.11.1 August 27, 2014 S3QLCP(1)
All times are GMT -4. The time now is 09:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy