Menu

only decompress newer file

CarlFK
2021-11-15
2022-05-09
  • CarlFK

    CarlFK - 2021-11-15

    wget -N http://raspi.debian.net/daily/raspi_4_bullseye.img.xz
    xz --keep -vv --decompress raspi_4_bullseye.img.xz

    Is there an option to only decompress newer files?

     
  • Jia Tan

    Jia Tan - 2022-01-11

    Hi! Just to clarify, are you looking for a command line option to check if the modification date / creation date on (filename).xz is newer than the modification date / creation date on (filename)? As of now, there is no such command line option to accomplish this, but it would be straightforward to wrap xz in a script to test for this.

     
  • CarlFK

    CarlFK - 2022-05-09

    no, not the date of the .xy file, but the date of the files being extracted compared to what might be on disk.

    I don't want this to happen:

    • xz --keep --decompress 2022-04-04-raspios-bullseye-armhf-lite.img.xz
      xz: 2022-04-04-raspios-bullseye-armhf-lite.img: File exists

    This throws an error, and aborts my script.

    also these are big files, so I would rather not take the time to extract just to find out I didn't need to.

     
  • Jia Tan

    Jia Tan - 2022-05-09

    As of now, there is no such option to only overwrite the file based on a timestamp check. You can force overwrite as a work around with the -f , --force option to avoid throwing an error and aborting your script. This will not help with avoiding the extra time to extract your files. That would require an extra option that does not currently exist. If you have time and want to contribute this feature, it would be considered. Unfortunately, it is not a priority so I am not planning on working it anytime soon. I hope this helps!

     

Log in to post a comment.