getting last X files, by modified date to build Rsync file list
hi,
I'm trying to (r)sync the last modified x files from a win share mounted to my linux (slim version of Ubuntu) what I basically do is using "ls -lt" (-ltrRe) to build the list, than modify the ls output using regex to taking off dirs and symbolic links, remove all un-needed info, than cut the first x lines, fix the output in order to build a file list of the needed files Last X files to sync. the problem is that I can't get the real path of the files using the regex as "ls -lt" list the directory on a separate line and i can't seem to get it right. Code:
The above works for a single folder, once there are sub-dirs inside /media/win the code Code:
$AWK -v srch="^" -v repl="$SOURCE/" '{ sub(srch,repl,$0); print $0 }' any help ? thanks, Nadav Ps i use bin files as variables such as $AWK as I plan to port the script, but they all link to the /bin/XYZ of ir |
please do not make such commands:
cat|grep|awk|grep|sed|sed|awk|awk Usually it can be replaced with one awk or perl script, that would be much better (readable). But I suggest you to use find Code:
find <rootdir> -type f -exec ls --time-style <format> {} \; | cut or sed what you do not need | sort | head -<XX lines> |
All times are GMT -5. The time now is 01:28 AM. |