|
|
|
|
|
|
|
![]() |
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
![]() |
#1 |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
![]() I've got over 10k in pages, 7 gigs total with images, that has no right mouse click code that I need to delete.
I have a few server scripts that will do search and replace on a server but they only work with one line of code at a time and if there is spaces in the file names and directories which seems to break the script and any of the pages and directories have spaces in the names. :( I do already have a tar file downloaded so I may just have to do this locally and then re-upload everything but damn it is 7 gigs. This is the code, <script language="JavaScript1.2"> if (window.Event) document.captureEvents(Event.MOUSEUP); function nocontextmenu() { event.cancelBubble = true event.returnValue = false; return false; } function norightclick(e) { if (window.Event) { if (e.which == 2 || e.which == 3) return false; } else if (event.button == 2 || event.button == 3) { event.cancelBubble = true event.returnValue = false; return false; } } if (document.layers) { document.captureEvents(Event.MOUSEDOWN); } document.oncontextmenu = nocontextmenu; document.onmousedown = norightclick; document.onmouseup = norightclick; //--> </script> |
![]() |
![]() |
![]() |
#2 |
Bonged
Join Date: Mar 2003
Location: BrisVegas, AUSTRALIA
Posts: 4,882
|
If you have the tar, you should only have to upload the changed HTML? yes?
I don't have a solution, but Ray - Webmastersguide/Strongbox, probably will... he should see this thread. DD
__________________
Old Dollars >>>> Now with over 90 Hosted Free Sites <<<< DangerDave.com.au - Adult Links to Free Porn |
![]() |
![]() |
![]() |
#3 |
No offence Apu, but when they were handing out religions you must have been out taking a whizz
|
Cleo,
UltraEdit has a very robust Global Search and Replace function built into it that will walk thru multiple files and directories that will do this for you easily. You can download a trial version of it at ultraedit.com and if you end up liking the product (I love it and have been using it for almost 10yrs) registration is only about $40.
__________________
Please Re-Read The Rules For Sig Files |
![]() |
![]() |
![]() |
#4 |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
Looks like ultraedit.com is about the same thing as bbedit.com which I use all the time, but just like bbedit doesn't do batch find and replace on the server.
Actually I looked through more files and the code is slightly different in the way it is written in almost every page. ![]() I'm having a hell of a time getting the tarball to download from the server without it getting corrupt. Best can I do is 2.6 megs transfer speed with my cable modem so it takes something like 18 hours and then ends up being corrupt in the end. I see that the server has rsync installed and my Mac also has rsync so I may end up mirroring the server's drive locally using rsync and just working on everything local. This way once it will still take a few days to get everything downloaded to my local drive but then only the changed files will get re-uploaded. |
![]() |
![]() |
![]() |
#5 |
Bonged
Join Date: Mar 2003
Location: BrisVegas, AUSTRALIA
Posts: 4,882
|
__________________
Old Dollars >>>> Now with over 90 Hosted Free Sites <<<< DangerDave.com.au - Adult Links to Free Porn |
![]() |
![]() |
![]() |
#6 |
WHO IS FONZY!?! Don't they teach you anything at school?
Join Date: Feb 2004
Posts: 42
|
Wouldn't it be easier to correct one of your scripts so that they handle filenames and directories containing spaces and run your script in your shell? Although, constructing the actual search and replace regexp is going to be a challenge if the script you want to strip is slightly different in each pages as you mentionned.
![]() Also, I'm wondering why you're downloading the whole 7 gigs (including pictures) when you could download a tar containing only html files... Entreri. |
![]() |
![]() |
![]() |
#7 |
No offence Apu, but when they were handing out religions you must have been out taking a whizz
|
good point Entreri!
use the --exclude [pattern] parameter to exclude all the .jpg files in the tarball and you'll reduce the size quite a bit (assuming that there's a bit of content in your directories.
__________________
Please Re-Read The Rules For Sig Files |
![]() |
![]() |
![]() |
#8 |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
Maybe I'm missing something but if I did a tar file and excluded the jpg, gif, wmv, etc. wouldn't I have a problem just replacing these files when I re-uploaded the html in keeping the directory structure as everything is in scatted nested directories all over the place?
|
![]() |
![]() |
![]() |
#9 | |
Bonged
Join Date: Mar 2003
Location: BrisVegas, AUSTRALIA
Posts: 4,882
|
Quote:
DD
__________________
Old Dollars >>>> Now with over 90 Hosted Free Sites <<<< DangerDave.com.au - Adult Links to Free Porn |
|
![]() |
![]() |
![]() |
#10 |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
To remove the code from the pages I don't have to move them. Can you un-tar something and have it replace only the html files while keeping the directories and files untouched?
But I'm thinking now it would probably be a good idea to also remove all the spaces from the directories, html files, and jpgs if I did decide to download this mess. The more I think about it I'm thinking it would probably be best to download one directory at a time and fix them slowly. I have very good find and replace tools on my Mac including a nice editor with Grep and GoLive as some very good site site maintenance tools for getting rid of all the spaces and fixing broken links. |
![]() |
![]() |
![]() |
#11 | |
Bonged
Join Date: Mar 2003
Location: BrisVegas, AUSTRALIA
Posts: 4,882
|
Quote:
![]() DD
__________________
Old Dollars >>>> Now with over 90 Hosted Free Sites <<<< DangerDave.com.au - Adult Links to Free Porn |
|
![]() |
![]() |
![]() |
#12 | |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
Quote:
|
|
![]() |
![]() |
![]() |
#13 |
Vagabond
|
http://www.sponsororganizer.com/FreeScripts/cleo.html
Save the script as cleo.pl Chmod it to 755 Run: find /main/domain/dir \( -name '*.html' -o -name '*.php' -o -name '*.htm' \) -exec cleo.pl {} \; It will run through all your .html, .php and .htm files and delete the code. Remember that it will open and save all files, even the ones that doesn't have the code in it (it will just not change anything). So if you have any files that are owned by the webserver user, it _might_ change the owner to the user you run the script as. I made a test run here on a bunch of files with and without the code in, and it worked like a charm. A hot advice is to make a test run in a temp folder ![]() My ICQ is 252081 if you need any help. Good luck if you decide to use it ![]() swed |
![]() |
![]() |
![]() |
#14 |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
This looks interesting.
Could I do find /home/foxy/web/members \( -name '*.html' -o -name '*.php' -o -name '*.htm' \) -exec ../../myscripts/remove-right-mouse-code.pl {} \; and this way it would only do the member's directory? |
![]() |
![]() |
![]() |
#15 | |
Vagabond
|
Quote:
If you only want to do the /home/foxy/web/members dir and no sub-dirs... do this: find /home/foxy/web/members \( -name '*.html' -o -name '*.php' -o -name '*.htm' \) -maxdepth 1 -exec ../../myscripts/remove-right-mouse-code.pl {} \; |
|
![]() |
![]() |
![]() |
#16 |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
Something is wrong.
I'm getting this. ../../myscripts/remove-right-mouse-code.pl: line 5: syntax error near unexpected token `s/(/<' ../../myscripts/remove-right-mouse-code.pl: line 5: `s/(/<script language="JavaScript1\.2">.*?document\.captureEvents\(Event\.MOUSEUP\).*?document\.captureEvents\(Event.MOUSEDOWN\).*?<\/script>)//sm;' ../../myscripts/remove-right-mouse-code.pl: undef: command not found |
![]() |
![]() |
![]() |
#17 | |
Vagabond
|
Quote:
What Perl version are you running? Type this on your server: perl -v What OS is your server running? |
|
![]() |
![]() |
![]() |
#18 |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
$ perl -v
This is perl, v5.8.3 built for i686-linux Copyright 1987-2003, Larry Wall $ uname -a Linux ashburn 2.4.26 #1 SMP Wed Apr 14 10:20:52 CDT 2004 i686 unknown |
![]() |
![]() |
![]() |
#19 |
Shut up brain, or I'll stab you with a Q-tip!
Join Date: Aug 2003
Posts: 114
|
I hope nobody minds if I stick my nose in here.
![]() The errors that Cleo reports look to me like they were generated by the shell, not by perl. When I try to execute the perl script I get a different error. I can come close to reproducing the error if I attempt to run the script as a bash shell script (which we would expect to fail): ejl@dangpow:~$ bash test.pl test.pl: undef: command not found test.pl: line 4: syntax error near unexpected token `s/(/<' test.pl: line 4: `s/(/<script language="JavaScript1\.2">.*?document\.captureEvents\(Event\.MOUSEUP\).*?document\.captureEvents\(Event.MOUSEDOWN\).*?<\/script>)//sm;' ########### Here is the error I get running the perl script: ejl@dangpow:~$ ./test.pl some.html Unmatched ( before HERE mark in regex m/( << HERE / at ./test.pl line 4. ejl@dangpow:~$ find . -name some.html -exec test.pl {} \; Unmatched ( before HERE mark in regex m/( << HERE / at ./test.pl line 4. ########### ejl@dangpow:~$ cat test.pl #!/usr/bin/perl -pi undef $/; s/(/<script language="JavaScript1\.2">.*?document\.captureEvents\(Event\.MOUSEUP\).*?document\.captureEvents\(Event.MOUSEDOWN\).*?<\/script>)//sm; ########### ejl@dangpow:~$ /usr/bin/perl -v This is perl, v5.6.1 built for i686-linux ejl@dangpow:~$ uname -a Linux dangpow 2.4.26 #1 SMP Tue Apr 20 20:19:50 PDT 2004 i686 unknown |
![]() |
![]() |
![]() |
#20 |
Vagabond
|
Damn me
![]() An extra / snuck itself into the script when I pasted it into cleo.html I've uploaded the correct one now. Sorry about that ![]() |
![]() |
![]() |
![]() |
#21 | |
Vagabond
|
Quote:
Thanks for looking up the bash part ![]() |
|
![]() |
![]() |
![]() |
#22 |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
Did you upload the new script?
Did a copy and paste of what you have there and got the same error. Which / am I suppose to remove? |
![]() |
![]() |
![]() |
#23 |
Shut up brain, or I'll stab you with a Q-tip!
Join Date: Aug 2003
Posts: 114
|
This is kind of interesting. What happens when you run these two commands:
file /usr/bin/perl and /usr/bin/perl -v |
![]() |
![]() |
![]() |
#24 |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
Gives you all kinds of interesting info :)
On my laptop % file /usr/bin/perl /usr/bin/perl: Mach-O executable ppc % /usr/bin/perl -v This is perl, v5.8.1-RC3 built for darwin-thread-multi-2level (with 1 registered patch, see perl -V for more detail) Copyright 1987-2003, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.com/, the Perl Home Page. On my server $ file /usr/bin/perl /usr/bin/perl: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.0.0, dynamically linked (uses shared libs), not stripped $ /usr/bin/perl -v This is perl, v5.8.3 built for i686-linux Copyright 1987-2003, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.com/, the Perl Home Page. |
![]() |
![]() |
![]() |
#25 |
Shut up brain, or I'll stab you with a Q-tip!
Join Date: Aug 2003
Posts: 114
|
I'm stumped. You're still getting the errors you first reported, right? With the "undef: command not found" stuff?
I don't get any errors when I run the new script. Here is how I tried it: 1. Copied all of the text from the browser window at the URL http://www.sponsororganizer.com/FreeScripts/cleo.html 2. pasted it into the vi editor in a terminal window on a linux system 3. saved and exited script. 4. chmod +x the new script 5. executed the script Can you show us the contents of the script as it is on the system you're running it on? (cat remove-right-mouse-code.pl ) |
![]() |
![]() |
![]() |
|
|