Unix / Linux: Check New Files In File System /var/www/uploads/

To check for new files in the /var/www/uploads/ directory in Unix/Linux, you can use the following command:

ls -ltr /var/www/uploads/ | tail

The ls -ltr command lists the contents of the directory in long format and sorts the output by modification time (-t) in reverse (-r) order. The tail command at the end shows the last few lines of the output, which will be the newest files in the directory.

You can also use the following command to monitor the directory in real-time and receive notifications when new files are added:

watch ls -ltr /var/www/uploads/

The watch command runs the specified command (ls -ltr /var/www/uploads/) repeatedly and updates the output in real-time. This can be useful for monitoring a directory for changes, such as new files being added.

Leave a Comment