This might work:
smbclient //server/share -A=/some/auth/file -TNc /some/timestamp/file - '/some/folder/*'
touch /some/timestamp/file
where:
- //server/share is your remote Windows share;
- /some/auth/file is a file containing your credentials for accessing that share;
- /some/timestamp/file is a file you use as a timestamp;
- /some/folder is a folder on the remote share you want to find new files in;
The idea is that you consider any file on the remote share newer than this local /some/timestamp/file as "new". If the cmbclient command receives anything other than 0 byte, you have new files. You may also pipe the standard output of the smbclient command to "| tar tvf -
" to get a list of the new files.
The problem with this approach is that it actually copies all the new files' contents over. If you have large files on the remote share, that would be a huge waste of bandwidth. If the remote system has a command similar to the Linux find
, you may run that instead of using tar
.