Sponsored Content
Full Discussion: Issue with copy command
Top Forums Shell Programming and Scripting Issue with copy command Post 303025799 by yuvi on Monday 12th of November 2018 11:56:41 AM
Old 11-12-2018
Issue with copy command

Hi,
I have a shell script which is having copy command. My need is to copy all the files in a directory into its subdirectory.

My directory structure is like this.

Dir1
file1.txt
file2.txt
file3.txt
subDir1
subDir1 is a subdirectory in Dir1.
Now I am trying to copy all the txt files in Dir1 into subDir1 by excluding subDir1. I used the below command.
cp -r !(subDir1) subDir1
When run the above command in terminal, it is working fine but when I used the same command in shell script, it is giving error as below.

syntax error near unexpected token `('

Please suggest.

Last edited by yuvi; 11-12-2018 at 01:16 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

copy command

what command would i wrote to copy files from $folder1 to $folder2 ???? (1 Reply)
Discussion started by: perleo
1 Replies

2. Linux

copy command

sir can any body tell me how i can copy files like copy c:\abc\pqr\mr.txt c:\windows\my documents\this.txt i need command in linux like this really i am a new in linux that is why simple questions alson can any body explain me how i get current directory tree or path in windows... (2 Replies)
Discussion started by: sadiquep
2 Replies

3. UNIX for Dummies Questions & Answers

Copy a command string from the command line

How can we copy a command string from a previous command line and paste it into the cursor position on the current command line? I know that ^c will not work as the shell will interpret as an interrupt signal. Thanks, (1 Reply)
Discussion started by: Pouchie1
1 Replies

4. UNIX for Dummies Questions & Answers

Issue with the copy command

Hi, I was copying a bunch of files from one folder to another.. while copy command was running i pressed 'ctrl C'...now these files are not present in the parent directory nor in the target folder... :eek: Where can find these files... Is there any way to get this files back.. :confused:... (2 Replies)
Discussion started by: Amey Joshi
2 Replies

5. Shell Programming and Scripting

Help with using grep command with copy command

Hi, im taking an entry Unix class, and as part of my lab assignment I have to copy all files in the /home/david/lab3 directory that have the file extension .save to your lab3/temp directory. I'm having trouble getting the grep to do anything worth while I've been trying to do: cp... (6 Replies)
Discussion started by: Critical jeff
6 Replies

6. Shell Programming and Scripting

Help with copy command

Hello, I have a directory in which I have files as follows CRDT.csv CRDT.csv.1 CRDT.csv.2 .... CRDT.csv.n I would like to copy it over to another directory as crdt_lon.csv crdt_lon.csv.1 crdt_lon.csv.2 .... crdt_lon.csv.n I am looking for a one line command but I am... (5 Replies)
Discussion started by: srattani
5 Replies

7. UNIX for Dummies Questions & Answers

Issue with Reflection - text copy beyond screen.

Hi, Gretings, While viewing the contents of a file using more/cat in Reflection, I am neither able to see the text beyond the width of screen, nor able to type it as well. I have tried changing windows settings also, but of no vail. Even if I cat/more a file and try to copy its contents, it... (1 Reply)
Discussion started by: dipanchandra
1 Replies

8. Shell Programming and Scripting

Variable value substitution issue with awk command issue

Hi All, I am using the below script which has awk command, but it is not returing the expected result. can some pls help me to correct the command. The below script sample.ksh should give the result if the value of last 4 digits in the variable NM matches with the variable value DAT. The... (7 Replies)
Discussion started by: G.K.K
7 Replies

9. Solaris

File copy issue in Solaris

Dears, I have one strange problem. When I copy file from source to destination using scp, file size decreased in destination side. I can see that copy progress is successful in source side. But when I check file size using du -sh command file size is 10 time smaller. First I looked into... (6 Replies)
Discussion started by: sembii
6 Replies

10. UNIX for Dummies Questions & Answers

Copy command

Hi , I am trying to take a backup of file before overwriting it with cp command, I am using the command cp -b. -rw-rw-r-- 1 autoengine murex 0 Jan 22 07:08 a -rw-rw-r-- 1 autoengine murex 0 Jan 22 07:08 b cp -b a b -rw-rw-r-- 1 autoengine murex 0 Jan 22 07:08 a -rw-rw-r-- 1... (1 Reply)
Discussion started by: Raj999
1 Replies
SVN_ADD(3)								 1								SVN_ADD(3)

svn_add - Schedules the addition of an item in a working directory

SYNOPSIS
bool svn_add (string $path, [bool $recursive = true], [bool $force = false]) DESCRIPTION
Adds the file, directory or symbolic link at $path to the working directory. The item will be added to the repository the next time you call svn_commit(3) on the working copy. PARAMETERS
o $path - Path of item to add. Note Relative paths will be resolved as if the current working directory was the one that contains the PHP binary. To use the calling script's working directory, use realpath(3) or dirname(__FILE__). o $recursive - If item is directory, whether or not to recursively add all of its contents. Default is TRUE o $force - If true, Subversion will recurse into already versioned directories in order to add unversioned files that may be hiding in those directories. Default is FALSE RETURN VALUES
Returns TRUE on success or FALSE on failure. NOTES
Warning This function is EXPERIMENTAL. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk. EXAMPLES
Example #1 svn_add(3) example In a working directory where svn status returns: $ svn status ? foobar.txt <?php svn_add('foobar.txt'); ?> ...will schedule foobar.txt for addition into the repository. SEE ALSO
SVN documentation on svn add. PHP Documentation Group SVN_ADD(3)
All times are GMT -4. The time now is 12:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy