bash - Linux - How to find files changed in last 12 hours without find command -


i need find files modified in last 12 hours. however, directory quite large using usual find command takes way long.

anyone have ideas doing quicker? thinking listing files, using head top 20 , check files only. i'm not sure.

any help?

update: of chosen answer, have figured out can find file without using find command. trick timestamp file names, use following code latest one:

ls -1 /directory/files*.txt | sort -nr | head -1

the file modification time stored in inode. whatever command use has read inodes files in directory. can make own script checking mtime, won't faster.

listing directory contents (filenames only) fast, try ls -1 (ls minus one).but listing file attributes mtime slow: ls -l (ls minus little l).

the file list in directory read in "random" order filesystem (the order depends on many things, static). can't use stopping after x number of files. ls -t lists files sorted mtime, has read mtime of files in order sort them.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -