Welcome Guest.   Make a donation to an author on the site August 21, 2014, 10:55:38 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2012! Download dozens of custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: IDEA: Create folder structure or path  (Read 9823 times)
IrmaIsfot
Charter Member
***
Posts: 9

View Profile Give some DonationCredits to this forum member
« on: April 22, 2009, 05:24:06 AM »

I would like to be able to create a 'copy' of a path. 

For example, let's say I have a file in this folder:
C:\Documents and Settings\All Users\Documents\My Pictures\

I would like to copy this file to D:\temp so that the path becomes like this:
D:\temp\Documents and Settings\All Users\Documents\My Pictures\

Now, I would have to go to D:\temp, create the first folder Documents and Settings, then enter that folder to create the next All Users folder, and so on, before I can copy my file to that location.

If possible, I'd like a right click option in Windows Explorer to select 'Copy with path' and then 'Paste and create path'.

I hope I have managed to explain myself?

Thanks!

/HĂ„kan, Sweden
Logged
IainB
Supporting Member
**
Posts: 4,618


Slartibartfarst

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #1 on: April 22, 2009, 05:15:33 PM »

It might help if I describe what I would do and/or actually do.
To do what you are suggesting - i.e., Create folder structure or path - I think I would first use xplorer2 (a brilliant product  Thmbsup ) to create a duplicate copy of just the directory structure. I have not needed to do this myself, but page 183 of the xplorer2 User Manual (Version 1.7.2.0-1) describes a 3-step approach to doing this:

Copying only the structure of a directory
This powerful command copies an entire directory structure into another
place, minus its contents. All the subfolders of the original directory are
copied recursively, but files in them are not copied.
The original directory is not affected by this command at all. To copy
structure, follow these three steps:

1. Select the top-level folder and press CTRL+C (or select the Edit |
Copy menu option)

2. Go to your destination folder (the folder where you want to place the
copied structure).

3. R-click and from the context menu that pops up, select the Paste
special | Folder structure menu option. (Instead of the context menu,
you can also use the Edit |Paste special | Folder structure menu
option.)


Once I had the duplicate structure set up, I would use the sync and mirror copy functions in xplorer2 to copy files individually or in blocks, from the original structure to the duplicate structure. I sometimes use this approach when manually updating/checking some of my duplicate files/directories on different devices- e.g., backup drives, or USB memory sticks that I use for portable applications.

The manual goes on to describe some circumstances under which you might find duplicating a directory structure useful:
It also describes the two ways to do it in Windows Explorer (one of which you described), and describes the corresponding disadvantages:

We never did this before because doing it with Windows Explorer had some
serious problems. With Windows Explorer, you can follow two different
optional methods to copy structure; and both have problems, as we will see:

> Copy the entire top-level folder to a new place (along with its
subfolders and their contents). Now find all files in this directory by
launching a search with *.* as your search condition. Explorer will
list all files in the directory. Select all of them and delete. This will
leave an empty folder structure that is identical to the original folder
system.

The disadvantage in this method is that you need a huge free disk
space at the destination drive, because the entire contents of the
original directory have to be accommodated there before you start
deleting them.

> Creating each subfolder manually. This is an extremely laborious
method if you have to create large directory structures. You may
make numerous mistakes, which requires enormous correction effort.
Besides, if you don’t realize your mistake, you will actually create a
different subfolder!


You can get a free Lite version, or buy a trial Pro version of xprorer2 from here: http://zabkat.com/

Hope this helps or is of use.  smiley
Logged
IrmaIsfot
Charter Member
***
Posts: 9

View Profile Give some DonationCredits to this forum member
« Reply #2 on: April 27, 2009, 03:28:56 PM »

Thanks for the suggestion!

This, however, is not what I want to achieve.  I found this free sw to do what I think you suggest to do with xplorer2: TreeCopy

But both of these two programs will create a whole tree of branches, when I only want one single branch!

If I want the branch \Documents and Settings\All Users\Documents\My Pictures\ (like in my first post) I would have to copy the 'Documents and Settings' level.  That would give me a copy that looks something like this:

D:
 | temp
     | Documents and Settings
         |  Administrator
              |  Everything below here
         |  All Users
              |  Application Data             
                  |  Everything below here
              |  Desktop
                  |  Everything below here
              |  Documents
                  |  My Pictures
              |  Favorites
                  |  Everything below here
              |  Start Menu
                  |  Everything below here
         |  Default User
              |  Everything below here
         |  User1
              |  Everything below here
         |  User2
              |  Everything below here

When all I really want is this:
D:
 | temp
     | Documents and Settings
         |  All Users
              |  Documents
                  |  My Pictures


Sure, I could use this method to create the complete empty structure, then copy my file to the desired destination, and finally use the convenient little DelEmpty-app by Skrommel.  But that's kind of an uggly solution...

So, suggestions please..?  huh  Is there maybe an easy way to do this already?

Otherwise, I'm thinking a program that adds options to the context menu in Windows Explorer.  When right-clicking a folder, the context menu would offer "Copy folder path" (implies from root to here), and when right clicking another folder, the menu would offer "Paste folder path" if one is present in the clipboard. 
If you do not want the complete path from the root, you could manually copy just a selection of it from the Address-bar, which places it in the clipboard, and thus makes it possible to paste with "Paste folder path".

Now, that'd be great!  cheesy

/HĂ„kan

Logged
MilesAhead
Member
**
Posts: 4,767



View Profile WWW Give some DonationCredits to this forum member
« Reply #3 on: April 27, 2009, 06:03:05 PM »

Does this look like what you mean?
http://www.codeproject.co...files/Folder_Utility.aspx
Logged

"Genius is not knowing you can't do it that way."
- MilesAhead
MilesAhead
Member
**
Posts: 4,767



View Profile WWW Give some DonationCredits to this forum member
« Reply #4 on: April 27, 2009, 07:10:39 PM »

AHK has a function to make the folder chain, so that part is easy.

This script provides an input box.  If you type (or paste)an absolute path such as c:\temp\temp\mytemp it will create the folder if it doesn't exist. If you type a path say test\test\mytest   it will start the chain in the working directory(where the script is located.) At the end it opens the folder so you can at least drag & drop the file(s) into it.  Guess I'm a bit lazy smiley

[copy or print]
;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         MilesAhead
;
; Script Function:
; Creates new folder chain and opens terminal folder
;

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#NoTrayIcon
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
InputBox,DirName,CreateDir,Enter New Folder to Create
If ErrorLevel
Exit
IfNotExist,%DirName%
FileCreateDir,%DirName%
run explorer %DirName%
Logged

"Genius is not knowing you can't do it that way."
- MilesAhead
IainB
Supporting Member
**
Posts: 4,618


Slartibartfarst

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #5 on: April 27, 2009, 07:28:41 PM »

@MilesAhead: That Code Project bit was spot-on.  Thmbsup
I was just wondering how to put that code into an AHK script (I am a beginner in AHK) when your post with the script popped up. Thanks! Nice work and smart thinking, Batman - if you don't mind my saying so! (...and at the risk of further inflating your possibly already over-inflated ego).   Grin
Logged
MilesAhead
Member
**
Posts: 4,767



View Profile WWW Give some DonationCredits to this forum member
« Reply #6 on: April 27, 2009, 07:42:48 PM »

Overinflated?  I was just thinking my humility has been holding me back all these years!! heh heh

Thank you.  I'm glad the OP posted the question because I'm new to ahk too and I didn't know that function was there.  Now I also have another handy small util.

I compiled it and zipped it up with a readme:

http://www.favessoft.com/hotkeys.html

Just scroll to the bottom of the page to download.

Logged

"Genius is not knowing you can't do it that way."
- MilesAhead
MilesAhead
Member
**
Posts: 4,767



View Profile WWW Give some DonationCredits to this forum member
« Reply #7 on: April 28, 2009, 11:20:48 AM »

I changed the program so that it doesn't use the script path as the working directory and added a command line param. The "working directory" is now the current directory of the command prompt, or the Start In value if run from a shortcut.  For relative paths if you type
CreateDir test\test
and the command prompt is in c:\temp
the result should be
c:\temp\test\test

it still pops up an InputBox with the command line already entered so that you can confirm that's the folder you want to create, or cancel.

It's available for download now.


« Last Edit: April 28, 2009, 11:22:45 AM by MilesAhead » Logged

"Genius is not knowing you can't do it that way."
- MilesAhead
Target
Honorary Member
**
Posts: 1,395



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #8 on: April 28, 2009, 06:00:39 PM »

here's another try -

[copy or print]
#singleinstance
#persistent
outpath:="::{20d04fe0-3aea-1069-a2d8-08002b30309d}"
return

$F11::
fileselectfolder, OUTPATH,*%OUTPATH%,3
Path_tmp:= outpath

loop, parse, clipboard,`n,`r
{
filegetattrib, myATTRIB, %A_loopfield%
ifnotinstring, myATTRIB, D
{
Stringgetpos,myPOS,a_loopfield,\,R
stringleft, mySTRING, a_loopfield, %MyPos%
}
else
MySTRING:=a_loopfield

if substr(mySTRING,2,1) = "`:"
stringtrimleft,mySTRING, mySTRING,3

loop, parse, mySTRING,\
{
filecreatedir,%path_tmp%\%a_loopfield%
Path_tmp.= "\" . a_loopfield
}
mySTRING:=
MyPOS:=0
PATH_tmp:=outpath
}
return


runs all the time, copy a folder (CTRL+C) and use the hotkey (F11) to duplicate the folder and it's associated path in the folder of your choice (you get a prompt to select the target dir when you use the hotkey

also works with files (the file name is stripped out of the path), and with multiple folder selections, ie selecting

C:\
   | Documents and Settings:
       |  Administrator
            |  All Users
            |  Application Data             
            |  Desktop
            |  Documents
            |  My Pictures
            |  Favorites
            |  Start Menu
       |  Default User
       |  User1
       |  User2

You'll end up with

D:
 | temp
     | Documents and Settings
         |  All Users
           |  Desktop
           |  Documents
           |  Favorites
 
the tray icon could also be removed to reduce the clutter

* folder_pth.ahk (0.62 KB - downloaded 274 times.)
Logged

"Look wise, say nothing, and grunt. Speech was given to conceal thought" - Sir William Osler
cranioscopical
Friend of the Site
Supporting Member
**
Posts: 4,167



see users location on a map View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #9 on: April 28, 2009, 07:06:23 PM »

Works perfectly here  Angry
Logged

Chris
Target
Honorary Member
**
Posts: 1,395



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #10 on: April 28, 2009, 07:43:24 PM »

sorry to disappoint embarassed
Logged

"Look wise, say nothing, and grunt. Speech was given to conceal thought" - Sir William Osler
MilesAhead
Member
**
Posts: 4,767



View Profile WWW Give some DonationCredits to this forum member
« Reply #11 on: April 29, 2009, 03:13:28 PM »

ChainCopy Beta    Thmbsup

edit: by the way if anyone notices any bugs feel free to post or you can email to the address shown in the Readme.txt file included with the download.
« Last Edit: April 29, 2009, 07:54:22 PM by MilesAhead » Logged

"Genius is not knowing you can't do it that way."
- MilesAhead
MilesAhead
Member
**
Posts: 4,767



View Profile WWW Give some DonationCredits to this forum member
« Reply #12 on: April 30, 2009, 03:01:22 PM »

Note that I updated CreateDir  command line handling.
/q switch quiet mode for scripts and batch files
/? switch shows a Help Dialog

ex quiet mode usage creates folders without prompting

CreateDir /q  dir\sub1  dir\sub2 c:\somedir\subdir2

Logged

"Genius is not knowing you can't do it that way."
- MilesAhead
fhayes
Charter Member
***
Posts: 18


see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #13 on: May 06, 2009, 06:42:06 PM »

I've been using this nifty free tool from RJLSoftware to do exactly what you're asking. It's called "TreeCopy"   
From the authors site:

Have you ever needed to copy a directory structure without copying the files? TreeCopy now makes this possible. Our small program will allow you to select the "from directory" and "into directory", and it will proceed to copy ONLY the directory structure. The utility is bundled with functionality such as a command line interface, calculate directories, Windows XP look and feel and much, much more!TreeCopy is a free download, so try it out.

oops, sorry, I see you've already found this one. Guess I should read the whole thread before posting..
« Last Edit: May 06, 2009, 06:53:11 PM by fhayes » Logged
DonL
Member
**
Posts: 152

View Profile WWW Give some DonationCredits to this forum member
« Reply #14 on: April 26, 2012, 05:13:07 AM »

I would like to be able to create a 'copy' of a path. 

For example, let's say I have a file in this folder:
C:\Documents and Settings\All Users\Documents\My Pictures\

I would like to copy this file to D:\temp so that the path becomes like this:
D:\temp\Documents and Settings\All Users\Documents\My Pictures\
Late revival, I know. But it happens to fit so well...

The latest XYplorer 11.00 features this functionality as "Copy Here With Path",  "Move Here With Path",  "Paste Here With Path". See http://www.xyplorer.com/r...se_11.00.htm#CopyWithPath
Logged
shmuel1
Participant
*
Posts: 32

View Profile Give some DonationCredits to this forum member
« Reply #15 on: May 21, 2012, 07:20:14 AM »

If you want to do this for backup or sync purposes, you might want to consider Beyond Compare. It's an excellent sync utility and it will automatically create the path for you.

On the left side, you would select the location to copy from, let's say "C:\Documents and Settings\All Users\Documents\My Pictures\"
On the right side you would select (in your example) D:\temp
Then you would copy "\Documents and Settings\All Users\Documents\My Pictures\" from the left side to the right side to get this:
"D:\temp\Documents and Settings\All Users\Documents\My Pictures\"
Then sync the folders. Beyond Compare gives you the option of automatically creating the directory structure.
Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.043s | Server load: 0.03 ]