Files in directories and subdirectories all still have .gz extension after extraction

Discussion in 'HOWTO-Related Questions' started by adamjedgar, Oct 5, 2018.

  1. adamjedgar

    adamjedgar Member

    Hi guys,
    I have downloaded a backup of one of my wordpress directories from a snapshot made from google cloud compute (i created a new instance based on snapshot, then downloaded to desktop)

    when i uploaded wordpress directory back to original server, i noticed that whilst wordpress folders are all extracted properly, the files inside them still have the .gz extension.

    I have tried a number of different methods to sort this but nothing is working.

    I went back to the google cloud snapshot and have realised that google cloud appears to have done this when it made the snapshot...the .gz extensions are found here on the uncompressed wordpress folder on the snapshot server.

    Not matter what i try, i cannot get recursive decompression for files in the /wordpress/ directory.

    Any ideas?
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    How have you tried it?
    Code:
    for f in wordpress/*.gz ; do gunzip $f ; done
    If recursion is needed, use find with -exec.
     
  3. adamjedgar

    adamjedgar Member

    ah...thats done the trick.
    Why did the other methods i have tried not work? (What is this doing differently?)

    oh hang on a minute...this hasnt recursively gone to files in subfolders...its only done the files in parent wordpress directory.
     
  4. adamjedgar

    adamjedgar Member

    how do i use find with -exec?
     
  5. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Not knowing what the other methods were I have no idea.
    You can either add directory levels to the command you used, like so:
    Code:
    for f in wordpress/*/*.gz ; do gunzip $f ; done
    or do it in one go with
    Code:
    find wordpress/ -name "*.gz" -exec ls -lh {} \;
    Test it first with the above command, ls -lh does not break anything but you see what files it would mess. If the files are the correct ones, change ls -lh to gunzip. And buy the manual pages so you can do
    Code:
    man find
     
    Last edited: Oct 5, 2018
  6. adamjedgar

    adamjedgar Member

    ah now that looks promising. I have managed to get it to list the files...so im confident im getting somewhere now.

    May i ask why it is that this happened in the first place? I have never had this happen before
     

Share This Page