安卓shell 移动某个时间之后的文件到另外一个文件夹 命令记录
find /storage/emulated/0/DCIM/Camera -maxdepth 1 -mtime -1 -type f -exec ls -l {} \;
ls -l /storage/emulated/0/DCIM/Camera | wc -l
ls -l /storage/emulated/0/DCIM/Camera.new | wc -l
供先测试一下
find /storage/emulated/0/DCIM/Camera -maxdepth 1 -mtime -1 -type f -exec mv -iv "{}" /storage/emulated/0/DCIM/Camera.new \;
(/storage/emulated/0/DCIM/Camera.new和/storage/emulated/0/DCIM/Camera.new/ 最后的斜杠加不加都行)
find --help
usage: find [-HL] [DIR...] [<options>]
Search directories for matching files.
Default: search "." match all -print all matches.
-H Follow command line symlinks -L Follow all symlinks
Match filters:
-name PATTERN filename with wildcards -iname case insensitive -name
-path PATTERN path name with wildcards -ipath case insensitive -path
-user UNAME belongs to user UNAME -nouser user ID not known
-group GROUP belongs to group GROUP -nogroup group ID not known
-perm [-/]MODE permissions (-=min /=any) -prune ignore contents of dir
-size N[c] 512 byte blocks (c=bytes) -xdev only this filesystem
-links N hardlink count -atime N[u] accessed N units ago
-ctime N[u] created N units ago -mtime N[u] modified N units ago
-newer FILE newer mtime than FILE -mindepth # at least # dirs down
-depth ignore contents of dir -maxdepth # at most # dirs down
-inum N inode number N -empty empty files and dirs
-type [bcdflps] (block, char, dir, file, symlink, pipe, socket)
-context PATTERN security context
Numbers N may be prefixed by a - (less than) or + (greater than). Units for
-Xtime are d (days, default), h (hours), m (minutes), or s (seconds).
Combine matches with:
!, -a, -o, ( ) not, and, or, group expressions
Actions:
-print Print match with newline -print0 Print match with null
-exec Run command with path -execdir Run command in file's dir
-ok Ask before exec -okdir Ask before execdir
-delete Remove matching file/dir
Commands substitute "{}" with matched file. End with ";" to run each file,
or "+" (next argument after "{}") to collect and run with multiple files.
cas:/storage/emulated/0/DCIM/Camera $ find --version
toybox 0.8.0-android
history命令,输出adb shell的历史命令
cas:/storage/emulated/0/DCIM/Camera $ history
1 cd /storage/emulated/0/DCIM/
2 ls
3 cd Camera
4 ls -l | wc -l
5 find . -mindepth 1 -maxdepth 1 -mtime -3
6 find --help
7 cd ..
8 find
9
10 cd /storage/emulated/0/DCIM/
11 ls
12 cd Camera
13 ls -l | wc -l
14 find . -mindepth 1 -maxdepth 1 -mtime -1 -exec ls -ld "{}" \;
数字加法
8 expr 106042 + 6551
9 expr 99235 +13358(expr: Unexpected extra input '+13358')
10 expr 99235 + 13358