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

Re: [Clip] Re: ^!MkDir

Expand Messages
  • Al
    ... Y all got me curious. this here O.S. that don t use drive letters but instead uses things like /home sh bash (shells. there s no command.com or cmd.exe)
    Message 1 of 21 , Feb 3, 2010
      loro wrote:
      > Actually, creating a chain of new directories works both with
      > command.com and cmd.exe here.
      >
      Y'all got me curious. this here O.S. that don't use drive letters but
      instead uses things like /home

      sh

      bash

      (shells. there's no command.com or cmd.exe)

      mkdir

      for make one at a time. But also has mkdirhier (make_dir_hierarchy).
      Makes unlimited levels deep (except eventually limited by ram and
      computer's resources)

      al@P5Q:~/temp/tst$ mkdirhier ./new1/new2/new3
      al@P5Q:~/temp/tst$ ls
      new1/
      al@P5Q:~/temp/tst$ pwd
      /home/al/temp/tst
      al@P5Q:~/temp/tst$ cd ./new1/new2/new3
      al@P5Q:~/temp/tst/new1/new2/new3$ pwd
      /home/al/temp/tst/new1/new2/new3
      al@P5Q:~/temp/tst/new1/new2/new3$
    • loro
      ... Ah, I didn t understand that. Thank you. Lotta
      Message 2 of 21 , Feb 4, 2010
        Axel Berger wrote:
        >loro wrote:
        > > Actually, creating a chain of new directories works both with
        > > command.com and cmd.exe here.
        >
        >Yes, that's why I tried it out in Win98 for you (relying on an old man's
        >memory like mine is a mug's game). Didn't work. One after the other went
        >fine.

        Ah, I didn't understand that. Thank you.

        Lotta
      • Alec Burgess
        This is an interesting thread though getting close to off-topic now. :-) (though all of the stuff we re talking about CAN be run from an NTB clip) I m running
        Message 3 of 21 , Feb 4, 2010
          This is an interesting thread though getting close to off-topic now. :-)
          (though all of the stuff we're talking about CAN be run from an NTB clip)

          I'm running WinXP and have cygwin and UnxUtils installed. I can't find
          any mkdirhier *BUT* when I check help for cygwin's mkdir I get:
          > sh-3.2$ mkdir --help
          > Usage: mkdir [OPTION] DIRECTORY...
          > Create the DIRECTORY(ies), if they do not already exist.
          >
          > Mandatory arguments to long options are mandatory for short options too.
          > -m, --mode=MODE set file mode (as in chmod), not a=rwx - umask
          > -p, --parents no error if existing, make parent directories as
          > needed
          > -v, --verbose print a message for each created directory
          > -Z, --context=CTX set the SELinux security context of each created
          > directory to CTX
          > --help display this help and exit
          > --version output version information and exit
          so the --parents argument appears to be what Lotta originally wanted.
          Note: that (afaict) executing mkdir at cmd prompt uses the (native) DOS
          mkdir while entering 'bash' or 'sh' (ie. one of the unix shells) at
          that command prompt ... then ... mkdir executes the cygwin or UnxUtils
          mkdir.exe

          so that gives us about 100 different ways to skin the cat :-)

          Al - if you do mkdir --help do you have the -p option?

          Al wrote:
          > loro wrote:
          >
          >> Actually, creating a chain of new directories works both with
          >> command.com and cmd.exe here.
          >>
          >>
          > Y'all got me curious. this here O.S. that don't use drive letters but
          > instead uses things like /home
          >
          > sh
          >
          > bash
          >
          > (shells. there's no command.com or cmd.exe)
          >
          > mkdir
          >
          > for make one at a time. But also has mkdirhier (make_dir_hierarchy).
          > Makes unlimited levels deep (except eventually limited by ram and
          > computer's resources)
          >
          > al@P5Q:~/temp/tst$ mkdirhier ./new1/new2/new3
          > al@P5Q:~/temp/tst$ ls
          > new1/
          > al@P5Q:~/temp/tst$ pwd
          > /home/al/temp/tst
          > al@P5Q:~/temp/tst$ cd ./new1/new2/new3
          > al@P5Q:~/temp/tst/new1/new2/new3$ pwd
          > /home/al/temp/tst/new1/new2/new3
          > al@P5Q:~/temp/tst/new1/new2/new3$
          >
          >
          >
          >

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



          [Non-text portions of this message have been removed]
        • Hugo Paulissen
          Hi, This looks as an elegant solution, and is not too much OT.
          Message 4 of 21 , Feb 4, 2010
            Hi,

            This looks as an elegant solution, and is not too much OT.

            http://www.dq.winsila.com/tips-tricks/productivity-tips/creating-multiple-sub-folders-using-mkdir-from-a-command-prompt.html

            Hugo





            ________________________________
            From: Alec Burgess <buralex@...>
            To: ntb-clips@yahoogroups.com
            Sent: Thu, February 4, 2010 3:39:05 PM
            Subject: Re: [Clip] Re: ^!MkDir


            This is an interesting thread though getting close to off-topic now. :-)
            (though all of the stuff we're talking about CAN be run from an NTB clip)

            I'm running WinXP and have cygwin and UnxUtils installed. I can't find
            any mkdirhier *BUT* when I check help for cygwin's mkdir I get:
            > sh-3.2$ mkdir --help
            > Usage: mkdir [OPTION] DIRECTORY...
            > Create the DIRECTORY(ies) , if they do not already exist.
            >
            > Mandatory arguments to long options are mandatory for short options too.
            > -m, --mode=MODE set file mode (as in chmod), not a=rwx - umask
            > -p, --parents no error if existing, make parent directories as
            > needed
            > -v, --verbose print a message for each created directory
            > -Z, --context=CTX set the SELinux security context of each created
            > directory to CTX
            > --help display this help and exit
            > --version output version information and exit
            so the --parents argument appears to be what Lotta originally wanted.
            Note: that (afaict) executing mkdir at cmd prompt uses the (native) DOS
            mkdir while entering 'bash' or 'sh' (ie. one of the unix shells) at
            that command prompt ... then ... mkdir executes the cygwin or UnxUtils
            mkdir.exe

            so that gives us about 100 different ways to skin the cat :-)

            Al - if you do mkdir --help do you have the -p option?

            Al wrote:
            > loro wrote:
            >
            >> Actually, creating a chain of new directories works both with
            >> command.com and cmd.exe here.
            >>
            >>
            > Y'all got me curious. this here O.S. that don't use drive letters but
            > instead uses things like /home
            >
            > sh
            >
            > bash
            >
            > (shells. there's no command.com or cmd.exe)
            >
            > mkdir
            >
            > for make one at a time. But also has mkdirhier (make_dir_hierarchy ).
            > Makes unlimited levels deep (except eventually limited by ram and
            > computer's resources)
            >
            > al@P5Q:~/temp/ tst$ mkdirhier ./new1/new2/ new3
            > al@P5Q:~/temp/ tst$ ls
            > new1/
            > al@P5Q:~/temp/ tst$ pwd
            > /home/al/temp/ tst
            > al@P5Q:~/temp/ tst$ cd ./new1/new2/ new3
            > al@P5Q:~/temp/ tst/new1/ new2/new3$ pwd
            > /home/al/temp/ tst/new1/ new2/new3
            > al@P5Q:~/temp/ tst/new1/ new2/new3$
            >
            >
            >
            >

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

            [Non-text portions of this message have been removed]







            [Non-text portions of this message have been removed]
          • Al
            Alec Burgess wrote: ... Yours didn t (go OT) cause I guess you can use Notetab to run your Cygwin bash shell. BTW I used to run
            Message 5 of 21 , Feb 4, 2010
              Alec Burgess wrote:

              <snip has cygwin on Win XP>
              > Al - if you do mkdir --help do you have the -p option?
              >
              Yours didn't (go OT) 'cause I guess you can use Notetab to run your
              Cygwin bash shell. BTW I used to run Cygwin (which has a rather
              powerful bash shell, BTW). But see my "sys" a few paragraphs down, I no
              longer have a need for Cygwin.

              Mine post here speaks not of Notetab but of "program able" and mkdir as
              relative to the bash shell.

              So, as courtesy, I would go to Off Topic list if/with yet any further in
              this "program able" vein that is or falls outside of the realm of
              Notetab and DOS or the program able Notetab editor. Thank you.

              al@P5Q:~$ cat /etc/slackware-version
              Slackware 12.2.0
              al@P5Q:~$

              Yep, mkdir -p (So I have at least 2 different ways to do it natively
              already onboard my sys) (ha ha, I got Win beat <grin>) -- my sys is
              Slackware 12.2 with the KDE desktop. On this sys is also the KVM virtual
              machine in which, amongst others, I have a Win XP and a Win 7 (which, at
              my whim) I may run and also I may use in said virtual machine. (I do
              have Notetab on that Win which runs in KVM).

              On my sys mkdir is a binary executable (the Linux equvalent of a Win
              .exe file) (Linux does not use file extensions which is a Win thing)

              al@P5Q:/bin$ lsag mkdir
              -rwxr-xr-x 1 root root 30968 2008-09-20 20:18 mkdir*
              al@P5Q:/bin$ pwd
              /bin
              al@P5Q:/bin$


              note: in next, the 1st ls returned nothing which means tst is an empty dir
              until we run the mkdir -p command and then ls now reveals sub folder(s)

              al@P5Q:~/temp/tst$ ls
              al@P5Q:~/temp/tst$ mkdir -p ./test1/test2/test3
              al@P5Q:~/temp/tst$ ls
              test1/
              al@P5Q:~/temp/tst$ cd test1/test2/test3
              al@P5Q:~/temp/tst/test1/test2/test3$ pwd
              /home/al/temp/tst/test1/test2/test3
              al@P5Q:~/temp/tst/test1/test2/test3$


              on my sys, mkdirhier is a sh (shell script). Just as DOS is scriptable,
              as Hugo pointed out, so is the Linux bash shell
              (scriptable/programmable) very much so.

              So, program able Notetab editor, program able DOS, program able bash shell.


              al@P5Q:~$ which mkdirhier
              /usr/bin/mkdirhier

              al@P5Q:~$ cat /usr/bin/mkdirhier
              #!/bin/sh
              # $Xorg: mkdirhier.sh,v 1.3 2000/08/17 19:41:53 cpqbld Exp $
              # Courtesy of Paul Eggert

              newline='

              <snip various case scenarios (protections against idiot user or
              keyboarding mistake)>
              <y'all don't want a bunch of new lines as a folder name on your hard
              drive, right?>

              # next, can seen the for loop that does the actual duty
              # It's much like the for loop that Hugo pointed out, DOS script style
              # but this is a bash script, not a DOS batch file

              for filename
              do
              path=$prefix$filename
              prefix=$path/
              shift

              test -d "$path" || {
              paths=$path
              for filename
              do
              if [ -n "$filename" -a "$filename" != "." ]; then
              path=$path/$filename
              paths=$paths$newline$path
              fi
              done

              mkdir $paths || status=$?

              break
              }
              done
              done

              exit $status
              # end

              Alan.
            • Al
              FWIW Win XP (mkdir /?) command console (cmd.exe I guess) whether or not extensions are installed makes a difference. next (500KB file size) is a screen shot
              Message 6 of 21 , Feb 5, 2010
                FWIW

                Win XP (mkdir /?) command console (cmd.exe I guess) "whether or not
                extensions are installed" makes a difference.

                next (500KB file size) is a screen shot of mkdir help (mkdir /?) from
                Win XP command console

                http://spiffyminer.tripod.com/mkdir_com.htm

                Additionally, said help reports "if extensions are installed"

                My bash mkdirhier and the content of web page Hugo pointed out, each
                could be considered an extension.

                And, how these "extend" is that these are script/batch_file that extends
                the capability of a built in command (via the use of for loop, etc. so
                as to gain even greater functionality).

                My guess is that the "extensions" mentioned on the mkdir help screen may
                be batch files or similar script files by Microsoft.

                Alan.
              Your message has been successfully submitted and would be delivered to recipients shortly.