{"id":97,"date":"2008-04-05T23:38:04","date_gmt":"2008-04-06T06:38:04","guid":{"rendered":"http:\/\/www.thewysz.com\/wyszdom\/?p=97"},"modified":"2025-05-14T15:38:06","modified_gmt":"2025-05-14T19:38:06","slug":"multi-file-find-replace-over-sftp","status":"publish","type":"post","link":"https:\/\/wysz.com\/wyszdom\/2008\/04\/multi-file-find-replace-over-sftp\/","title":{"rendered":"Multi-file find &amp; replace over SFTP"},"content":{"rendered":"\n<p>I recently heard from <a href=\"http:\/\/www.koklynn.com\/\">Koklynn<\/a> (via <a href=\"http:\/\/nelsobradley.blogspot.com\/\">Nelson<\/a>) that Google Analytics had <a href=\"http:\/\/analytics.blogspot.com\/2007\/12\/announcing-new-graphing-tools-gajs.html\">changed their tracking code<\/a>. I like to keep things up to date, so I started the process of replacing the old code with the new. It took about 10 seconds to update the template on my WordPress-powered blog, but I also have a bunch of static HTML files sitting around from my <a href=\"http:\/\/www.thewysz.com\/hotw\/\">old site<\/a>.<\/p>\n\n\n\n<p>Usually when I want to do a multi-file find and replace, I just fire up <a href=\"http:\/\/www.barebones.com\/products\/textwrangler\/\">TextWrangler<\/a> and go at it. However, I only knew how to specify the folder to search if I could access it from the Finder. I didn&#8217;t want to download, edit, and then re-upload all of my files, and the current Finder won&#8217;t mount volumes over SFTP. Smart people can probably just SSH into their accounts and type a few lines to do what I wanted, but <a href=\"http:\/\/www.thewysz.com\/wyszdom\/2008\/03\/hey-nerd\/\">I&#8217;m not smart<\/a>. I needed to find a way to use a GUI to find and replace over a bunch of HTML files via SFTP.<\/p>\n\n\n\n<p>I quickly discovered that TextWrangler can open files via SFTP, but I couldn&#8217;t figure out how to specify the path to search in the multi-file search. I also tried dragging the folder I wanted over from <a href=\"http:\/\/cyberduck.ch\/\">Cyberduck<\/a>, but that didn&#8217;t work either. I needed to get these files from the Finder. I then remembered that <a href=\"http:\/\/www.mattdougherty.com\/blog\/2008\/03\/posting-from-imac.html\">Matt had been using macFUSE<\/a> to do FTP uploads from the Finder. I hadn&#8217;t really read up on <a href=\"http:\/\/code.google.com\/p\/macfuse\/\">macFUSE<\/a>, but it sounded like something could would work for me. So I went ahead and installed the core package, and then found <a href=\"http:\/\/www.sccs.swarthmore.edu\/users\/08\/mgorbach\/MacFusionWeb\/\">MacFusion<\/a>, which gave me a nice GUI, allowing me to quickly mount my server account in the Finder. <em>(<\/em><a href=\"#update\"><em>See update at bottom of post.<\/em><\/a><em>)<\/em> I went ahead and dragged the public_html folder to the sidebar, so I was able to quickly locate it in the Find\/Replace window of TextWrangler after clicking on <em>Other:<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"666\" height=\"515\" src=\"https:\/\/wysz.com\/wyszdom\/wp-content\/uploads\/2008\/04\/find-replace-1.png\" alt=\"\" class=\"wp-image-98\" style=\"object-fit:cover\" title=\"find-replace\" srcset=\"https:\/\/wysz.com\/wyszdom\/wp-content\/uploads\/2008\/04\/find-replace-1.png 666w, https:\/\/wysz.com\/wyszdom\/wp-content\/uploads\/2008\/04\/find-replace-1-300x232.png 300w\" sizes=\"auto, (max-width: 666px) 100vw, 666px\" \/><\/figure>\n\n\n\n<p>I also set up a filter so TextWrangler would only check the HTML files, by clicking on <em>Options<\/em> and then <em>Edit Filter.<\/em><\/p>\n\n\n\n<p>After that, I just sat back and let it go:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"380\" height=\"181\" src=\"https:\/\/wysz.com\/wyszdom\/wp-content\/uploads\/2008\/04\/finding-and-replacing-1.png\" alt=\"find\/replace status window\" class=\"wp-image-99\" title=\"Finding and Replacing\" srcset=\"https:\/\/wysz.com\/wyszdom\/wp-content\/uploads\/2008\/04\/finding-and-replacing-1.png 380w, https:\/\/wysz.com\/wyszdom\/wp-content\/uploads\/2008\/04\/finding-and-replacing-1-300x143.png 300w\" sizes=\"auto, (max-width: 380px) 100vw, 380px\" \/><\/figure>\n\n\n\n<p>I think I got everything converted to the new code, but if you find any of the old stuff lying around go ahead and <a href=\"mailto:wysz@thewysz.com\">let me know<\/a>.<\/p>\n\n\n\n<p>But wait! This post isn&#8217;t over yet; I have three more Mac geek-related things:<\/p>\n\n\n\n<p>1: This is my first post with WordPress 2.5 using images. This is notable, because when I first tried the image uploader, I got an HTTP error. After some searching, I learned that this is caused by a problem with the Mac version of Flash. A variety of solutions were proposed, but it looked like they all involved either installing a plugin or disabling a security feature, two things I don&#8217;t like to do without good reason. Then, I noticed on the WordPress <a href=\"http:\/\/trac.wordpress.org\/ticket\/6278\">bug filed for the issue<\/a> that the fix was simply to disable the Flash uploader for Macs if the mod_security module is enabled. This fix isn&#8217;t in the current release of WordPress, but it was easy enough for me to create the same effect without modifying any source code. I just went into Safari&#8217;s preferences, opened the <em>Security<\/em> tab, and unchecked <em>Enable plug-ins.<\/em> That disabled Flash, and I was able to use the alternate uploader with no problem.<\/p>\n\n\n\n<p>2. Speaking of images, it&#8217;s nice that when I do a \u2318-Shift-4-Space capture of a window it includes the drop shadow, but I&#8217;d also like the option to not capture the shadow without having to manually select the window using the crosshairs or opening Grab or another utility.<\/p>\n\n\n\n<p>3. I like that I can use the familiar Mac-standard \u2318I and \u2318B keyboard shortcuts in the WordPress 2.5 visual editor. I don&#8217;t think this worked in earlier versions.<\/p>\n\n\n\n<p><a name=\"update\"><\/a> <strong>Update:<\/strong> As I was closing out my windows for the day I realized that MacFusion, although cool, was unnecessary. I had already mounted my account on the desktop successfully via <a href=\"http:\/\/code.google.com\/p\/macfuse\/wiki\/MACFUSE_FS_SSHFS\">sshfs<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently heard from Koklynn (via Nelson) that Google Analytics had changed their tracking code. I like to keep things up to date, so I started the process of replacing the old code with the new. It took about 10 seconds to update the template on my WordPress-powered blog, but I also have a bunch &hellip; <a href=\"https:\/\/wysz.com\/wyszdom\/2008\/04\/multi-file-find-replace-over-sftp\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Multi-file find &amp; replace over SFTP<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-97","post","type-post","status-publish","format-standard","hentry","category-geek"],"_links":{"self":[{"href":"https:\/\/wysz.com\/wyszdom\/wp-json\/wp\/v2\/posts\/97","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wysz.com\/wyszdom\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wysz.com\/wyszdom\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wysz.com\/wyszdom\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/wysz.com\/wyszdom\/wp-json\/wp\/v2\/comments?post=97"}],"version-history":[{"count":2,"href":"https:\/\/wysz.com\/wyszdom\/wp-json\/wp\/v2\/posts\/97\/revisions"}],"predecessor-version":[{"id":3265,"href":"https:\/\/wysz.com\/wyszdom\/wp-json\/wp\/v2\/posts\/97\/revisions\/3265"}],"wp:attachment":[{"href":"https:\/\/wysz.com\/wyszdom\/wp-json\/wp\/v2\/media?parent=97"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wysz.com\/wyszdom\/wp-json\/wp\/v2\/categories?post=97"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wysz.com\/wyszdom\/wp-json\/wp\/v2\/tags?post=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}