Page 2 of 2

Re: Folder Copy w/sub levels.

Posted: 20 Mar 2011 18:20
by Stefan
1. wish:
admin wrote: copy the folder to the clipboard (select folder, then Ctrl+C),
then goto the target
and do menu Edit / Paste Special / Paste Folder Structure.
Note: usually i am on an file for which i want to make the same folder structue in an other folder.
So i want to ask to let this feature works for <curitem(s)> too, taking just the parent folder as argument.


2. wish:

Code: Select all

new()
Creates a new file or folder.

Syntax 
      new(name, [type=file|dir], [source], [rename=|r])

        name [Required] Name of the new item to be created.
        If no path is passed, the current path is taken as default. 
As far as i see,
If no full path is passed
Then only the last folder from an path string is created:

Code: Select all

new "sub folder\fld", dir;   //only "fld" is created here.
i have to use

Code: Select all

new "<curpath>\sub folder\fld", dir;  
to create all new sub folders


So i think from my point of view this could be improved.
And as second improvement i suggest to auto remove the colon if any.

Right now i use:

Code: Select all

$path= "<curpath>";
 $path= replace($path, ":");
 $item= "<curname>";
 focus "PI";
 new "<curpath>\$path", dir;
 //copy file code goes here

Re: Folder Copy w/sub levels.

Posted: 20 Mar 2011 18:36
by GamaRex
Success! I installed v9.90.0500 and experimented with the codes provided.

For the record, here are the scripts that worked:

$colFullPath = folderreport("dirs", "r", , "r");
$colRelativePath = replace($colFullPath, "<curpath>\");
msg $colRelativePath;
copytext $colRelativePath; //to clipboard

Address bar:
::folderreport("dirs", "clipboard", ,"r");

Re: Folder Copy w/sub levels.

Posted: 20 Mar 2011 19:04
by j_c_hallgren
GamaRex wrote:Success! I installed v9.90.0500 and experimented with the codes provided.
Good ! Figured that you had vers that was too old...
For the record, here are the scripts that worked:

Code: Select all

$colFullPath = folderreport("dirs", "r", , "r");
   $colRelativePath = replace($colFullPath, "<curpath>\");
        msg $colRelativePath;
        copytext $colRelativePath; //to clipboard

Address bar:
::folderreport("dirs", "clipboard", ,"r");
FYI: It helps readability to select your script code and use the forum 'code' tags.

Re: Folder Copy w/sub levels.

Posted: 20 Mar 2011 19:12
by GamaRex
FYI: It helps readability to select your script code and use the forum 'code' tags.
I can see the difference. I'll try that when I have code to post in the future. Thanks!

Re: Folder Copy w/sub levels.

Posted: 21 Mar 2011 08:55
by admin
Stefan wrote:1. wish: ...
All wishes agreed and fulfilled.

Exception: auto remove the colon -- I'm not sure if this is good. It could hide a mistake from the user.

Re: Folder Copy w/sub levels.

Posted: 21 Mar 2011 09:48
by Stefan
admin wrote:
Stefan wrote:1. wish: ...
All wishes agreed and fulfilled.
Thank you.
Stefan wrote:2. wish: i suggest to auto remove the colon if any.
Exception: auto remove the colon -- I'm not sure if this is good. It could hide a mistake from the user.
Yes you are right.

For example creating an collection using folderreport("dirs", "r", , "r");
and use this as template for new folders.

Right now it would create an absolute path if the drive exist:
new "C:\temp\sub folder\fld", dir;

My suggestion would create an relative path as sub-folders:
new "C\temp\sub folder\fld", dir;

But I think we can handle this our own by using
$path= replace($path, ":");
right before using new()


But for an non-script solution there could be an option to remove the colon
so the average user can duplicate an folder structure.


I see there is
EDIT > Paste Special > Paste Folder structure
and
d&d context menu > create folder/branch here
but they both only create sub-folders, starting from current folder.
( While i am in "X:\one\two\three" i get only "three\four\five\" )

But often i need to make an copy of the parent folders structure.
( While i am in "X:\one\two\three" i need to get "X\one\two\" as copy [included an GoTo deepest sub-folder?].
And then i would copy "three\four\five\" into that new created path )


(sorry. it's more then i want to suggest right now. but as i am on it...)
.

Re: Folder Copy w/sub levels.

Posted: 21 Mar 2011 09:53
by admin
Well, try to find some fellows for this wish... I think it's a bit exotic. Such refinements should be left for scripting.