Re: move files using find
Nevermind. I ended up figuring it out. Granted it's not for BB, but just as a follow-up if anyone comes across this thread they will have what I came up with: find /tmp/test -type f \( -name \*.typelib -o -name \*.gir \) -exec /bin/sh -c 'TEMP="${1#*/}"; mkdir -p "${0}/${TEMP%/*}" 2>/dev/null; mv -- "$1" "${0}/${TEMP%/*}"' "/tmp/test.gir" {} \; This preserves the path when finding/copying files from a source to a destination. Dave On 7/14/17, David Hendersonwrote: > Oops! It does appear that I was using GNU find, not BB. Sorry about > that. Any thoughts on how this can be done without execdir then using > BB find? > > Thanks, > Dave > > > On 7/14/17, Denys Vlasenko wrote: >> On Thu, Jul 13, 2017 at 11:52 PM, David Henderson >> wrote: >>> Good evening all! I am trying to move files from one location to >>> another while preserving the path. If I search for a directory, it >>> seems like I have found the correct syntax: >>> >>> find "/usr/local/share/man" -type d -execdir mv -- {} "/opt/test" \; >>> >>> However, if I try to move files, I can't seem to figure it out: >>> >>> find "/tmp/test" -type f \( -name \*.typelib -o -name \*.gir \) >>> -execdir mv -- {} "/opt/test/" \; >>> >>> To which I get "No such file or directory" or "Not a directory" error. >> >> I'm getting >> >> find: unrecognized: -execdir >> >> as expected, since bbox knows nothing about find -execdir. >> > ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: move files using find
Oops! It does appear that I was using GNU find, not BB. Sorry about that. Any thoughts on how this can be done without execdir then using BB find? Thanks, Dave On 7/14/17, Denys Vlasenkowrote: > On Thu, Jul 13, 2017 at 11:52 PM, David Henderson > wrote: >> Good evening all! I am trying to move files from one location to >> another while preserving the path. If I search for a directory, it >> seems like I have found the correct syntax: >> >> find "/usr/local/share/man" -type d -execdir mv -- {} "/opt/test" \; >> >> However, if I try to move files, I can't seem to figure it out: >> >> find "/tmp/test" -type f \( -name \*.typelib -o -name \*.gir \) >> -execdir mv -- {} "/opt/test/" \; >> >> To which I get "No such file or directory" or "Not a directory" error. > > I'm getting > > find: unrecognized: -execdir > > as expected, since bbox knows nothing about find -execdir. > ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: move files using find
On Thu, Jul 13, 2017 at 11:52 PM, David Hendersonwrote: > Good evening all! I am trying to move files from one location to > another while preserving the path. If I search for a directory, it > seems like I have found the correct syntax: > > find "/usr/local/share/man" -type d -execdir mv -- {} "/opt/test" \; > > However, if I try to move files, I can't seem to figure it out: > > find "/tmp/test" -type f \( -name \*.typelib -o -name \*.gir \) > -execdir mv -- {} "/opt/test/" \; > > To which I get "No such file or directory" or "Not a directory" error. I'm getting find: unrecognized: -execdir as expected, since bbox knows nothing about find -execdir. ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox