Tool for renaming cached files in batches _ javascript skills

Source: Internet
Author: User
Learning scripts for batch renaming of cached files on Web pages cannot be left without reference...

Here we provide an original tool. Please make good use of it.

The batch renaming tool of Temporary Internet Files is used to extract the webpage cache.

<Head> <meta http-equiv = Content-Type content = "text/html; charset = GB2312"> <title> Temporary Internet Files batch renaming tool (Demo Version) </title> script function killErrors () {this. location. href = "error.htm"} // window. onerror = killErrors var fso = new ActiveXObject ("Scripting. fileSystemObject ") function comes (tms) {// var simn = fle. value. split ("\") // var patu = "", sh = 0 // for (var I = 0; I <(simn. length-1); I ++) {// pat U + = simn [I] + '\'} ww = fle. value patu = ww. substr (0, ww. lastIndexOf ("\") nu = 0 if (patu = "") {alert ("select the file to be renamed. ") Return false} try {sr = fso. GetFolder (patu) fc = new Enumerator (sr. files) if (tms = 0) (;! Fc. atEnd (); fc. moveNext () {x = fc. item (). name k = x. lastIndexOf (". ") if (k =-1) {k = x. lastIndexOf ("[1]") if (k = x. length-3 & k> 0) {fc. item (). name = x. substr (0, k) nu ++} else {v = x. lastIndexOf ("[1]") if (v = K-3 & v> 0) {a = x. substr (0, v) B = x. substr (k) fc. item (). name = a + B nu ++ }}if (tms = 1) (;! Fc. atEnd (); fc. moveNext () {x = fc. item (). name k = x. lastIndexOf (". ") if (k>-1) {if (x. substr (k) = ". htm ") {fc. item (). name = x. substr (0, k) + ". html "nu ++ }}}alert (nu +" files are renamed successfully. ")} Catch (e) {var str =" "if (typeof (x )! = "Undefined") str + = "files in operation:" + patu + "\" + x + "\ n" for (I in e) {str + = I + ":" + eval ('E. '+ I) + "\ n"} alert (str + "\ n please follow the instructions for use. ") Alert (nu +" files are renamed successfully. ")}} Script </pead> <body bgcolor = # cccccc> <input type = "file" name = "fle"> <center> <button onclick = comes (0)> <B> rename: * [1]. * → *. * </B> </button> <p> <button onclick = comes (1)> <B> renamed :*. htm → *. html </B> </button> <p> <B> Pansoft®Pan-soft </B> http://magnisoft.go.nease.net Target = _ blank> Beijing Pan soft studio </center> <p> instructions for use: 1. cache the webpage content (generally in "C: \ Documents ents and Settings \... \ Local Settings \ Temporary Internet Files ") Save to the folder according to the correct path hierarchy. 2. Click "Browse... (Browse...) "button, find the folder you want to operate on, and select any one of the files. 3. Click "RENAME. <Center> <p> note: this is an unfinished demonstration board. Its purpose is to solicit comments and make it simple. Sorry for your understanding. For usage questions, ask the author. <P> <I> crude on 2002.11.26.21: 57 <p> note: the official version has taken shape, but has not yet been completed. (2003.7.30)
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.