1
I’m trying to archive and upload an old website to statically hosted Amazon S3 area.
I was able to get the contents with wget
, using the following command:
wget --mirror --no-parent --html-extension --page-requisites http://original.com
Then, I could replace all the links to their new URL, by:
ag -l original\.com -0 | xargs -0 sed -i '' \
's|original.com|old.original.com|g'
After this, I uploaded the website to Amazon S3 using s3cmd sync
.
My only problem now that all the “cache-busted” assets are now access denied on Amazon. The problem is that wget
got the files with query parameters included in their filename and I’ll need to rename them.
So I’d like to rename files recursively, in all subfolder, like:
style.css?ver=4.2.5.css
is renamed tostyle.css
How can I do that in Mac OS X using Bash 3.2?
rename
doesn’t exist in Mac OS X. – JakeGould – 2015-09-29T17:06:56.637Running your command in Mac OS X results in: “find: rename: No such file or directory” – JakeGould – 2015-09-29T17:11:11.570
I believe if you'd mention "brew install rename" it'd be a valid answer for OS X. – hyperknot – 2015-09-29T18:22:12.993
@zsero I don’t hate Homebrew, but the problem with Homebrew for most people is,
brew install rename
is not something most users can do without heavy lifting. First, Homebrew requires Xcode (4GB+ download) and related command line tools be installed. Then Homebrew itself needs to be installed. And only then doesbrew install [something]
seem elegant. More casual users than not who need a simple solution are not going down that path to solve a simple issue that could be handled via tools already a part of Mac OS X. – JakeGould – 2015-09-29T18:37:45.747You can actually use $1, that way it'd be more elegant, no need for var. – hyperknot – 2015-09-30T14:11:45.100