![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How do you copy files from CD | Schnell | SCO | 2 | 10-01-2007 12:29 PM |
| copy of files | bkan77 | UNIX for Advanced & Expert Users | 2 | 09-06-2007 03:53 AM |
| How to copy N files from one dir to another | GMMike | UNIX for Dummies Questions & Answers | 1 | 10-13-2005 05:50 AM |
| copy files | chirayus | UNIX for Advanced & Expert Users | 6 | 04-12-2004 08:56 AM |
| Copy all files | 42!? | UNIX for Dummies Questions & Answers | 4 | 08-25-2002 09:05 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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 [ ! -d ${tgt_path}]; then mkdir -p ${tgt_path} #mkdir -p abc/xyz fi cp ${src_path}/aaa* ${tgt_path}/ Thanks MR |
| Forum Sponsor | ||
|
|
|
|||
|
Code looks ok..however one minor mistake I noticed maybe that helps
See below see if it works: #!/bin/sh src_path=/home/owngdw/abc tgt_path=/home/owngdw/abc/xyz if [ ! -d ${tgt_path} ]; then mkdir -p ${tgt_path} #mkdir -p abc/xyz fi cp ${src_path}/aaa* ${tgt_path}/ If not then let me know the error while executing it. |
|
|||
|
Hi ,
Ok,I will post u the scnerio later.However copying files and subdirectories between directories at specific time interval and want to prompt the destination directory name at run time ( Prompt the name ,when it enters that will check ,if it exists already exit and say that name already exist else create ) Thanks , MR |
|||
| Google UNIX.COM |