Sonntag, 26. Februar 2023
I wanted to change the file time (creation/access/change) according to the date and time encoded in the filename.
Here are two examples using awk:

For filenames of type '20221206_191944.jpg':
$ for f in *_*; do t=$(echo "$f" | awk -F '[_.]' '{print substr($1$2,0,12) "." substr($2,5,2)}'); echo touch -t "$t" "$f"; done >> ../timestamps.sh

which yields
touch -t 202212061919.44 20221206_191944.jpg

And for filenames of type 'IMG-20220419-WA0005.jpg':
$ for f in *WA*; do t=$(echo "$f" | awk -F '[-]' '{print $2 "0000"}'); echo touch -t "$t" "$f"; done >> ../timestamps.sh

which yields a
touch -t 202204190000 IMG-20220419-WA0005.jpg

... link (0 Kommentare)   ... comment


Sonntag, 18. Oktober 2020
"Fortschrittsbalken" bei dd
Hi, long time no see. :-)

Fortschritt bei diskimages mit dd beobachten?
Werner Fischer hat in seinem Beitrag ein paar interessante Möglichkeiten aufgezählt: https://www.thomas-krenn.com/de/wiki/ISO_Image_von_CD_oder_DVD_unter_Linux_erstellen

* mit pv (pipe viewer):
dd if=/dev/cdrom | pv --size 700M | dd of=test.iso

* mit der dd-option status=progress (seit GNU Coreutils v8.24)

* mit signal killall -USR1 aus einer anderen shell (für ältere Coreutils)
watch -n 4 killall -USR1 dd
Kann man das vielleicht als subshell in einer einzigen Befehlszeile starten?

... link (0 Kommentare)   ... comment


Montag, 29. Dezember 2014
complete Backup of Jolla
The Jolla Phone has several interesting partitions:

/dev/mmcblk0p19 on /drm type ext4
/dev/mmcblk0p18 on /firmware type vfat
/dev/mmcblk0p25 on /persist type ext4
/dev/mmcblk0p9 on /var/systemlog type ext4
/dev/fuse on /home/nemo/android_storage type fuse
/dev/mmcblk0p28 on / type btrfs
/dev/mmcblk0p28 on /home type btrfs


btrfs has snapshot support, so we use it.
Then all filesystems are tared and zipped and ssh'ed to a backup-host as follows:

btrfs subvolume snapshot -r / /snapshots/root
btrfs subvolume snapshot -r /home/ /snapshots/home

tar -cpz /drm/ | ssh markus@192.168.1.12 "( cat > Jolla_backup/`date +%y%m%d`_drm.tar.gz )"
tar -cpz /firmware/ | ssh markus@192.168.1.12 "( cat > Jolla_backup/`date +%y%m%d`_firmware.tar.gz )"
tar -cpz /persist/ | ssh markus@192.168.1.12 "( cat > Jolla_backup/`date +%y%m%d`_persist.tar.gz )"
tar -cpz /var/systemlog/ | ssh markus@192.168.1.12 "( cat > Jolla_backup/`date +%y%m%d`_systemlog.tar.gz )"
tar -cpz /home/nemo/android_storage/ | ssh markus@192.168.1.12 "( cat > Jolla_backup/`date +%y%m%d`_android_storage.tar.gz )"

tar -cpz /snapshots/root/ | ssh markus@192.168.1.12 "( cat > Jolla_backup/`date +%y%m%d`_root.tar.gz )"
tar -cpz /snapshots/home/ | ssh markus@192.168.1.12 "( cat > Jolla_backup/`date +%y%m%d`_home.tar.gz )"

btrfs subvolume delete /snapshots/home/ /snapshots/root/

after were finished the snapshots are deleted and were fine.

... link (0 Kommentare)   ... comment