Loading ...
Sorry, an error occurred while loading the content.
 

[Clip] Re: delete files containing a search term

Expand Messages
  • Sheri
    ... Why did you put the ^!Keyboard stuff in there? If I had to use a pure clip, assuming ^!DestroyDoc doesn t require the file to be loaded, I d do the same
    Message 1 of 8 , Jan 17, 2009
      --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
      >
      > Sheri wrote:
      > > --- In ntb-clips@yahoogroups.com, "dpasseng" <don@> wrote:
      > >> So I look for all files that contain the word rumplestiltskin, I
      > >> use copytext to get a list of those files per our prior thread a
      > >> few weeks ago (whew forgot how but got it eventually ... that
      > >> thing isn't totally intuitive). Now I want to delete each and
      > >> every one of these files ... how ... a clip I presume ...
      > >
      > > If it were me, I think I would load up the captured list as a
      > > document, do a regex replacement so that the file name on each line is
      > > surrounded by double quotes and prefaced with del space. Then I would
      > > save it as a bat file and run it with a script such as:
      > >
      > > ^!Toolbar New Document
      > > ^!InsertText ^$GetDOSOutput("^$GetDataPath$DelMyFile.bat" 2>&1)$
      > >
      > > The 2>&1 part makes not only the standard output, but also standard
      > > error stream make it into the inserted text.
      > >
      > > Regards,
      > > Sheri
      > >
      > Absolutely fascinating suggestion. So the "delete" space "file
      > name" when run as a bat would delete each file. When you say
      > "del" you mean that literally as del is a dos command then I
      > presume. I skipped the dos years I think as I was probably on an
      > osbourne during those years running CP/M instead.
      >
      > Here is what I did so far:
      > :Loop
      > ^!Select Eol
      > ^!Set %file%="^$GetSelection$"
      > ^!If "^%file%" = "" END
      > ^!Keyboard BACKSPACE DELETE
      > ^!KeyboardDelay 10
      > ^!DestroyDoc ^%file%
      > ^!Goto Loop
      >
      > Did about 1000 out of 2000 files in about two or three minutes
      > tops I'd estimate.
      >

      Why did you put the ^!Keyboard stuff in there?

      If I had to use a pure clip, assuming ^!DestroyDoc doesn't require the
      file to be loaded, I'd do the same thing as before but instead of del
      space, I'd put ^!DestroyDoc in front of each quoted file name. Then
      I'd paste the whole thing into a clip and run it.

      I'd expect the bat file to be the faster though.

      Regards,
      Sheri
    • Don - HtmlFixIt.com
      ... Also fascinating! So just make my file into a clip, would be easy peasy. I did it to process one file at a time. And since this is not a repetitive
      Message 2 of 8 , Jan 17, 2009
        >> Here is what I did so far:
        >> :Loop
        >> ^!Select Eol
        >> ^!Set %file%="^$GetSelection$"
        >> ^!If "^%file%" = "" END
        >> ^!Keyboard BACKSPACE DELETE
        >> ^!KeyboardDelay 10
        >> ^!DestroyDoc ^%file%
        >> ^!Goto Loop
        >>
        >> Did about 1000 out of 2000 files in about two or three minutes
        >> tops I'd estimate.
        >>
        >
        > Why did you put the ^!Keyboard stuff in there?
        >
        > If I had to use a pure clip, assuming ^!DestroyDoc doesn't require the
        > file to be loaded, I'd do the same thing as before but instead of del
        > space, I'd put ^!DestroyDoc in front of each quoted file name. Then
        > I'd paste the whole thing into a clip and run it.
        >
        > I'd expect the bat file to be the faster though.

        Also fascinating! So just make my file into a clip, would be easy
        peasy. I did it to process one file at a time. And since this is not a
        repetitive process, doing it one time would be fine. Of course this
        clip is "reusable" with another list of files another day.

        I was using the keyboard stuff to advance to the next file and then
        destroy what was on that line. I knew I could also just use cursor
        advance, but this seemed to work ... after I added a short delay. I
        know it's not the fastest.

        I need to put learning dos/batch commands onto my list of things to do.

        I have learned so much from this group it isn't funny.
      • Alec Burgess
        Don - HtmlFixIt.com (don@htmlfixit.com) wrote (in part) (on 2009-01-17 ... commands onto my list of things to do. ... Don (others) - don t know whether you
        Message 3 of 8 , Jan 17, 2009
          Don - HtmlFixIt.com (don@...) wrote (in part) (on 2009-01-17
          at 10:07):
          > I need to put learning dos/batch

          commands onto my list of things to do.


          > I have learned so much from this group it isn't funny.

          Don (others) - don't know whether you were paying attention when we
          discussed the "$GetDosOutput$ clip (especially making it an icon on your
          clipbar) a couple of months ago :-)

          To recap:
          Clip:
          H=GetDOSOutput
          ^!set %theCommand%=^?[Dos command=dir "D:\Temp\*.*" 2>&1]
          ^!InsertText ^%theCommand% ^p
          ^$GetDosOutput("^%theCommand%")$

          The "default" command is just an innocuous DOS command that will be a valid
          DOS command. I normally override it with the command I wish to test or
          execute. Based on Sheri's suggestion I just added the "2>&1". Without it if
          you type "garbage" in the wizard you get a popup error saying:

          No output produced by "c:\windows\system32\cmd.exe /c garbage"

          If instead you leave the 2>&1 on your command line you see:

          garbage 2>&1
          'garbage' is not recognized as an internal or external command,
          operable program or batch file.

          I already knew that, but when I DON"T know what the problem is this makes
          it a lot easier to debug! :-)

          --
          Regards ... Alec (buralex@gmail & WinLiveMess - alec.m.burgess@skype)


          [Non-text portions of this message have been removed]
        • Sheri
          ... Hi Alec, I guess I missed that conversation, but I like that clip! FWIW I just changed it a little. Now has last previous command if reused, and keeps the
          Message 4 of 8 , Jan 17, 2009
            --- In ntb-clips@yahoogroups.com, Alec Burgess <buralex@...> wrote:
            >
            > Don (others) - don't know whether you were paying attention when
            > we discussed the "$GetDosOutput$ clip (especially making it an
            > icon on your clipbar) a couple of months ago :-)
            >
            > To recap:
            > Clip:
            > H=GetDOSOutput
            > ^!set %theCommand%=^?[Dos command=dir "D:\Temp\*.*" 2>&1]
            > ^!InsertText ^%theCommand% ^p
            > ^$GetDosOutput("^%theCommand%")$
            >
            > The "default" command is just an innocuous DOS command that will
            > be a valid DOS command. I normally override it with the command I
            > wish to test or execute. Based on Sheri's suggestion I just added
            > the "2>&1". Without it if you type "garbage" in the wizard you
            > get a popup error saying:
            >
            > No output produced by "c:\windows\system32\cmd.exe /c garbage"
            >
            > If instead you leave the 2>&1 on your command line you see:
            >
            > garbage 2>&1
            > 'garbage' is not recognized as an internal or external command,
            > operable program or batch file.
            >
            > I already knew that, but when I DON"T know what the problem is
            > this makes it a lot easier to debug! :-)
            >
            > --
            > Regards ... Alec (buralex@gmail & WinLiveMess - alec.m.burgess@skype)
            >
            >

            Hi Alec,

            I guess I missed that conversation, but I like that clip! FWIW I just
            changed it a little. Now has last previous command if reused, and
            keeps the redirection behind the scene.

            H="GetDOSOutput"
            ^!IfEmpty "^%theCommand%" Next Else Skip
            ^!Set %theCommand%="dir "C:\""
            ^!set %theCommand%=^?{Dos command=^%theCommand%}
            ^!InsertText ^%theCommand% 2>&1^p
            ^$GetDosOutput("^%theCommand%" 2>&1)$
            ;end of clip

            Regards,
            Sheri
          • Alec Burgess
            Sheri (silvermoonwoman@comcast.net) wrote (in part) (on 2009-01-17 at ... Hi Sherri - you re up late ;-) Good idea ... DONE I substituted %theCommand% by
            Message 5 of 8 , Jan 17, 2009
              Sheri (silvermoonwoman@...) wrote (in part) (on 2009-01-17 at
              23:41):
              > I guess I missed that conversation, but I like that clip! FWIW I just
              > changed it a little. Now has last previous command if reused, and
              > keeps the redirection behind the scene.
              >
              > H="GetDOSOutput"
              > ^!IfEmpty "^%theCommand%" Next Else Skip
              > ^!Set %theCommand%="dir "C:\""
              > ^!set %theCommand%=^?{Dos command=^%theCommand%}
              > ^!InsertText ^%theCommand% 2>&1^p
              > ^$GetDosOutput("^%theCommand%" 2>&1)$
              > ;end of clip

              Hi Sherri - you're up late ;-)

              Good idea ... DONE

              I substituted %theCommand% by %theDosCommand% only because my habit is
              frequently
              to use variables like %theFile%, %theBuffer" etc. and some day I'm bound
              to wind up with a conflict!

              I had briefly considered putting past commands into either the main INI
              file or a separate one to simulate the same
              capabilities the Find/Replace dialog has but never got-a-round-tuit.

              Flo?


              [Non-text portions of this message have been removed]
            Your message has been successfully submitted and would be delivered to recipients shortly.