Reputation: 1
$ find /opt/backup/test -name "*.gz" -exec smbclient -A \
/opt/backup/smbclient_authentication.txt //1.1.1.1/test -c put '{}' \;
There are multiple directories and other files then *.gz
under the dir and I want to move the files found with find with smbclient. Of course, this does not work, since I am missing the last bit. Connection to the share works, and find
works, it's just the last bit that does not. Any ideas?
Upvotes: 0
Views: 10635
Reputation: 9281
You can use xargs to create parameters from input stream
xargs find /opt/backup/test -name "*.gz" \
| smbclient -A /opt/backup/smbclient_auth.txt //1.1.1.1/test -c put
If I understand correctly you want to move the files locally besides transferring the via smb. You could:
set -e #<- abort on error
for f in `find -name '*.gz' -or -name '*.zip'`; do
smbclient -A /opt/backup/smbclient_auth.txt //1.1.1.1/test -c put "$f"
mv "$f" ./transfered/
done
Upvotes: 1