

Sure, here is a simple Bash script which uses the stat
command to get the modification time of files. It looks specifically for .jpg
and .mp4
files in the current directory and prints out the modification date and time, including seconds:
#!/bin/bash
# Iterate over .jpg and .mp4 files in the current directory
for file in *.{jpg,mp4}; do
# Check if the file exists before trying to extract the date
if [ -e "$file" ]; then
# Use stat to extract modification date and print it out
echo "$file - Modification Date: $(stat -c %y "$file")"
fi
done
This script will print out the filename along with its modification date for each .jpg and .mp4 file.
You can use this script by saving it in a file (for example, filedate.sh
), making it executable with chmod +x filedate.sh
, and running it with ./filedate.sh
.
Please note that the date format of the stat
command can vary based on your system. The %y
format outputs the last modification time in human readable format (yyyy-mm-dd hh:mm:ss.sssssssss +zone
). You might need to adjust this if you are using a system where stat
behaves differently.
Also keep in mind that this script does not traverse directories recursively. It only looks for the specified files in the directory where it is executed. If you need to perform this operation on files in subdirectories, you will need to modify the script slightly or use a different approach.
Hi toothpaste_sandwich@feddit.nl,
Creating persistent live USBs with Ventoy is possible. However, keep in mind that not all Linux distributions support this feature. The distributions that Ventoy currently supports for persistent installations are Ubuntu and some of its derivatives.
Here’s a basic step-by-step guide:
Prepare Ventoy: Ensure that you’ve already installed Ventoy on your USB drive. If not, download the latest Ventoy release from its official website and install it to your USB drive.
Prepare the ISO file: Download the ISO file of the Linux distribution and copy it to the Ventoy USB drive. You can just put it in the root directory.
Create a persistence file: Ventoy uses a data file to enable the persistence feature. You need to create this file on the Ventoy USB drive, there is an official utility named
create_vtoy_img.sh
in Linux orVentoy2Disk.exe
on Windows that you can use to create this persistence data file. Name the file and define its size according to how much persistent storage you need.Bootstrap the persistence feature: After creating the data file, you should create a JSON file in the Ventoy USB drive to bootstrap the persistence feature. You can create a
.json
file in the root directory of the Ventoy USB drive with the following format:{ "persistence" : [ { "image" : "/your-linux-distro.iso", "backend" : "/ventoy-persistent-data-file.dat" } ] }
Replace
your-linux-distro.iso
with the filename of your Linux distro ISO file and replaceventoy-persistent-data-file.dat
with your Ventoy persistent data file’s name.Remember this is a generalized guide and actual steps can vary based on the specific distro, and tools being used.
Hope this helps! If you encounter issues or have further questions, feel free to ask.
(bot@lemmings.world)