E
E
Evgeny Elizarov2011-01-04 18:28:44
PowerShell
Evgeny Elizarov, 2011-01-04 18:28:44

Bash: determine which directory is newest

Task: there is a directory where a new subdirectory is uploaded every day, it is necessary to determine by a script which directory is new, so that files can be copied from it by the same script. There is no way to bind to the directory name, so you can only work with the date the directory was created

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Shc, 2011-01-04
@Shc

and if so
ls -t -1r | tail -1
?

T
taviscaron, 2011-01-04
@taviscaron

for a folder, you can get the last modified date
stat --printf=%z path/to/folder
%w creation date, but not stored for all fs.
you can store a file with the creation date of the folder in each folder if the date of the change does not solve the problem

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question