cp --parents requires path as destination, can it be made to take filena
From:
Aaron Peterson
Subject:
cp --parents requires path as destination, can it be made to take filename?
Date:
Sun, 30 Nov 2008 03:39:28 -0800
Hi, I just spent a few hours learning how to find files and got a cp
command up that looked like it should work..
I ran into a problem that was very tough to find the solution to though,
cp: with --parents, the destination must be a directory
Try `cp --help' for more information.
I have since found a promising lead that suggested using the dirname
command to solve my problem.. hours later that I wish I knew that.
anyway, is there some drastic reason why --parents doesn't work with a
full filename with filname and path?
btw, I need the paths
-T --parents seems like it should make it write to a file...
#!/bin/bash
DESTDIR="/media/disk/highpriority"
find -maxdepth 2 -type f -name '*' | while read line; do
DESTtail=`echo "$line" | cut -c 2-` ;
#echo cp -v "$line" "$DESTDIR$DESTtail";
cp -T --parents -v "$line" "$DESTDIR$DESTtail";
done
Thanks.
[Prev in Thread]
Current Thread
[Next in Thread]
cp --parents requires path as destination, can it be made to take filename?,
Aaron Peterson<=