2

I used AWS cli to sync my S3 bucket to my computer before deleting the bucket. I did not notice it right after the sync but I now realized that most of my files have been turned into hex files (?). For example, a CSS file I had now looks like:

1f8b 0800 632b 405b 02ff cd5c 4d93 e4b8

71bd fb57 9477 439e 1945 574f 83f5 5d1d

b256 b643 111b b10a 1d56 071d 7c01 49b0

0ad3 24c1 01c1 eeae e998 ff6e 8044 b2c0

ea07 7a1d 7bb1 0eab 69e0 0104 8187 4466

e2b1 3eff f15f ff65 f1c7 c5e2 afaa 368b

bfbc 8856 5562 b1be 4fee 1f16 e965 f153

ce9f c589 d7f9 65b1 5c9c 8d69 8e9f 3f17

and so on.

Not all of my files have been transformed but there does not seem to be any obvious pattern to which files have been transformed. The file sizes seem more or less consistent with original uncorrupted files from what I remember.

Is this my files being corrupted while syncing or is there something else going on? Can I do something to recover my files? I do not have access to the original S3 bucket anymore.

tripatheea
  • 123
  • 2

1 Answers1

1

The first two bytes of your file, 0x1f 0x8b, are the magic number signifying the gzip file compression format. You likely had stored these files, gzipped, in the bucket so that they could be downloaded by browsers in their compressed format, using less bandwidth, and they have been synced to your computer exactly as they existed in S3.

To verify, make a copy in a safe place, then -- working only on the copy, not the original -- rename one test file, e.g. foo.css to foo.css.gz, then run gzip -d foo.css.gz. This should leave you with a file called foo.css with content that is in a more recognizable form.

Michael - sqlbot
  • 22,658
  • 2
  • 63
  • 86