![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum 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 |
| absolute path | Kirichiko | UNIX for Dummies Questions & Answers | 2 | 10-03-2007 03:30 AM |
| $PWD shows absolute path vs path w/symbolic links | kornshellmaven | Shell Programming and Scripting | 3 | 06-13-2007 09:15 AM |
| absolute path | filedeliver | High Level Programming | 4 | 06-05-2007 02:18 PM |
| vi - replacing a relative path with absolute path in a file | Yinzer955i | UNIX for Dummies Questions & Answers | 2 | 09-07-2006 08:47 AM |
| HOW to make absolute path???? HELP | youngvet | High Level Programming | 1 | 11-01-2003 01:58 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#8
|
|||
|
|||
|
From my first reply:
Code:
find . -type f -name 'tmp*' -print | ... |
| Forum Sponsor | ||
|
|
|
#9
|
|||
|
|||
|
find & copy files with absolute path
thanks for reply
i tried this also but fail. can u please give whole script. |
|
#10
|
|||
|
|||
|
Have you try to find out why it fails?
Put some effort into solving the problem with the given examples instead of always asking for the right answers. Regards |
|
#11
|
|||
|
|||
|
find & copy files with absolute path
Quote:
cd /home/jagannath.n dated=$(date +%d-%m-%y) test -d /home/jagannath.n/tmp/$dated | mkdir /home/jagannath.n/tmp/$dated file=$(find . -name test* -print) cp -rf $file /home/jagannath.n/tmp/$dated my problem is solved using above script but it print below error . cp: cannot stat `./Azureus': No such file or directory cp: cannot stat `Downloads/SHELL': No such file or directory cp: cannot stat `SCRIPTING': No such file or directory cp: cannot stat `IN': No such file or directory cp: cannot stat `LINUX/VTC': No such file or directory cp: cannot stat `-': No such file or directory cp: cannot stat `UNIX': No such file or directory cp: cannot stat `SHELL': No such file or directory cp: cannot stat `SCRIPTING': No such file or directory cp: cannot stat `ADVANCED/Course': No such file or directory cp: cannot stat `Files/Chapter': No such file or directory is it error? |
|
#12
|
|||
|
|||
|
It's because you don't quote the arguments properly. But just adding double quotes around "$file" doesn't really help, either, because it's not a single file. I'd still recommend using tar or cpio for this.
Note there are two |:s before the mkdir, it's an "or"; "a || b" is a shorthand for "if not a then b" (which is equivalent to "a or b"). |
|
#13
|
|||
|
|||
|
try this
Code:
#! /usr/bin/ksh cd /home/backup/ find /home/abc/ -name "*.s" | while read line do p=$(dirname $line ) p1=$(echo $p | sed 's/\///') mkdir -p $p1 cd $p1 tocopy=$(pwd) echo $tocopy cp $line $tocopy cd - done |
|
#14
|
|||
|
|||
|
That will still not cope with file names with spaces in them. Proper quoting, please!!
|
|||
| Google The UNIX and Linux Forums |