getting path

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gwen

    #1

    getting path

    Hi, I have a code to copy/move folders to a specified folder on the
    root drive - ie c:\stuff However, I also have the folder "stuff" on
    the root of other partitions as well - ie d:\stuff, e:\stuff, etc.
    I would like the code to work so that the selected folder for
    moving/copying will always go to the "stuff" folder of the drive that
    it is on. In other words, if a folder is selected on the d drive, it
    will be moved to d:\stuff, if it's on the c: drive, it will be moved
    to c:\stuff.
    The way the code is now, the path of the destination folder must be
    stated specifically in the code.
    And the way it works is a browse for folder dialogue comes up to
    select the folder to be copied or moved, and after clicking ok, the
    move or copy is made, but always to c:\stuff.

    any help most appreciated.
    tia

    gwen
  • Rick Rothstein

    #2
    Re: getting path

    > Hi, I have a code to copy/move folders to a specified folder on the[color=blue]
    > root drive - ie c:\stuff However, I also have the folder "stuff" on
    > the root of other partitions as well - ie d:\stuff, e:\stuff, etc.
    > I would like the code to work so that the selected folder for
    > moving/copying will always go to the "stuff" folder of the drive that
    > it is on. In other words, if a folder is selected on the d drive, it
    > will be moved to d:\stuff, if it's on the c: drive, it will be moved
    > to c:\stuff.
    > The way the code is now, the path of the destination folder must be
    > stated specifically in the code.
    > And the way it works is a browse for folder dialogue comes up to
    > select the folder to be copied or moved, and after clicking ok, the
    > move or copy is made, but always to c:\stuff.[/color]

    Take the 3 left characters from the Folder Path returned by your "Browse for
    Folder Dialogue" routine and concatenate the know folder name "stuff" onto
    it...

    SaveTo = Left$(FolderRet urnedByFolderDi alog, 3) & "stuff"

    Rick - MVP


    Comment

    • jenny

      #3
      Re: getting path

      "Rick Rothstein" <rickNOSPAMnews @NOSPAMcomcast. net> wrote in message news:<2JqcnUvQK eHg8rmiU-KYvg@comcast.co m>...[color=blue][color=green]
      > > Hi, I have a code to copy/move folders to a specified folder on the
      > > root drive - ie c:\stuff However, I also have the folder "stuff" on
      > > the root of other partitions as well - ie d:\stuff, e:\stuff, etc.
      > > I would like the code to work so that the selected folder for
      > > moving/copying will always go to the "stuff" folder of the drive that
      > > it is on. In other words, if a folder is selected on the d drive, it
      > > will be moved to d:\stuff, if it's on the c: drive, it will be moved
      > > to c:\stuff.
      > > The way the code is now, the path of the destination folder must be
      > > stated specifically in the code.
      > > And the way it works is a browse for folder dialogue comes up to
      > > select the folder to be copied or moved, and after clicking ok, the
      > > move or copy is made, but always to c:\stuff.[/color]
      >
      > Take the 3 left characters from the Folder Path returned by your "Browse for
      > Folder Dialogue" routine and concatenate the know folder name "stuff" onto
      > it...
      >
      > SaveTo = Left$(FolderRet urnedByFolderDi alog, 3) & "stuff"
      >
      > Rick - MVP[/color]


      I have a problem along the same lines in a way.
      I have common named folders on all drives too ( c:\storage,
      d:\storage, and so on) and in each folder there are various other
      folders all commonly prefixed and suffixed, like abcProject123,
      abcDocs123, and so on.

      I am trying to create a button a form that when clicked will bring up
      an Input box asking to enter the name of a folder to be retrieved
      (moved) from whatever Storage folder it is in. So if user enters Docs
      and clicks OK, abcDocs123 is moved and renamed to the root of the same
      drive the folder stored on.
      In other words, if abcDocs123 was in E:\Storage, it would be moved to
      E:\Docs.

      Presently, I have the problem partially solved using dos-vbs in a bat
      file which can be called by the shell function:

      echo fn=InputBox("En ter folder name. ","Folders")>%T EMP%.\FN.VBS
      echo wscript.echo "SET FN="&fn>>%TEMP% .\FN.VBS
      cscript //nologo %TEMP%.\FN.VBS> %TEMP%.\FN.BAT
      CALL %TEMP%.\FN.BAT
      for %%a in (c: d: e: f: g: h: i: j: k:) do if exist
      "%%a\storage\ab c%FN%123\NUL" move "%%a\storage\ab c%FN%123" "\%FN%"

      What the above does:
      brings up an Input box, a folder name is entered, and the folder is
      found in whatever drive it is in (c: to k:) The problem is that it
      can't move the found folder unless that folder is on the same drive as
      the bat file is run from.
      So if the bat file is run from the c: drive, only folders found in
      c:\storage will be moved to c:\ Move cannot move accross drives but
      if VB can make the code so that the found folder will be moved to the
      root of whatever drive it is on, then move can always be used and it
      would be acceptable and better than using dos-vbs. thanks for any
      help!
      jenn

      Comment

      Working...