Help ! Create new empty folders
Help ! Create new empty folders
Hi
Would it be possible to have a script that copy the names of all the folders selected and create the same folders in another main folder but only the name of the folders must be duplicated, not the contents.
Thanks for your help
Ysl
Would it be possible to have a script that copy the names of all the folders selected and create the same folders in another main folder but only the name of the folders must be duplicated, not the contents.
Thanks for your help
Ysl
Re: Help ! Create new empty folders
If the folder structure is dynamic (i.e. you need to copy various different folder collections) then a script would be the way to go, but I leave it to the experts to come up with a one-line script to do it.
But, if the structure is always the same folder collection you need in various places, then you should look into "Edit/New Items", which lets you create a complete folder structure (even with some files in it) and copy this structure to the current folder with a single click.
But, if the structure is always the same folder collection you need in various places, then you should look into "Edit/New Items", which lets you create a complete folder structure (even with some files in it) and copy this structure to the current folder with a single click.
Ralph 
(OS: W11 24H2 Home x64 - XY: Current x32 beta - Office 2024 32-bit - Display: 1920x1080 @ 125%)
(OS: W11 24H2 Home x64 - XY: Current x32 beta - Office 2024 32-bit - Display: 1920x1080 @ 125%)
Re: Help ! Create new empty folders
Code: Select all
"Create Those Folders"
//Get Location of where Folders will be created.
$dir=InputFolder("<curpath>", "Where would you like to create these folders?");
//Generate and execute a script to create each new item.
Load(Report("New('$dir\{Name}','dir');"),, "s");Re: Help ! Create new empty folders
EDIT: Sorry, i was to slow with formating, so others are faster.
http://88.191.26.34/XYwiki/index.php/Sc ... info%28%29
(i hope you don't mean "with all sub folders" ?)
> and create the same folders
http://88.191.26.34/XYwiki/index.php/Sc ... ent:_while
http://88.191.26.34/XYwiki/index.php/Sc ... mmand:_new
> in another main folder
http://88.191.26.34/XYwiki/index.php/Sc ... mand:_goto
> Thanks for your help
HTH?
BTW: here is my test code, created with the help of this community, the wiki and XYs help:
NOTE: It has no error handling! It works for me, but please test before you would use it for real work
OMG, Update
Today i would code it like this:
> Would it be possible to have a script that copy the names of all the folders selectedYsl wrote:Hi
http://88.191.26.34/XYwiki/index.php/Sc ... info%28%29
(i hope you don't mean "with all sub folders" ?)
> and create the same folders
http://88.191.26.34/XYwiki/index.php/Sc ... ent:_while
http://88.191.26.34/XYwiki/index.php/Sc ... mmand:_new
> in another main folder
http://88.191.26.34/XYwiki/index.php/Sc ... mand:_goto
> Thanks for your help
HTH?
BTW: here is my test code, created with the help of this community, the wiki and XYs help:
NOTE: It has no error handling! It works for me, but please test before you would use it for real work
Code: Select all
$items = getinfo("selecteditemsnames","?"); //list names of selected items with an "?" as delimiter
$items = regexreplace( $items, '(.+).', "$1"); //drop last delim
//msg $items;
GoTo "C:\Temp\"; // goto other location
//GoTo inputfolder(); // prompt for folder
while strlen($items)>0 { // as long as there is any content
$delimPos = strpos($items, "?"); // Get pos of delimiter
IF ($delimPos=='-1'){ // If no delim anymore
$folder = $items
}else{
$folder = substr($items,0,$delimPos); // first part of $items till delim
}
//msg $folder;
new $folder, dir; // create folder
IF ($delimPos=='-1'){ // If no delim anymore
$items = // emtpy the var
}else{
$items = substr($items, $delimPos +1); // fill var with rest of items only
//msg $items;
}
}
OMG, Update
Today i would code it like this:
Code: Select all
$items = getinfo("selecteditemsnames","|");
$Count = getinfo("countselected");
GoTo inputfolder("<curpath>"); // prompt for folder
$Loop=1;
while($Loop<=$Count)
{
$folder = gettoken($items, $Loop, "|");
new $folder, dir; // create folder
incr $Loop;
}
Last edited by Stefan on 26 Jul 2010 21:23, edited 1 time in total.
Re: Help ! Create new empty folders
Oppsy... I forgot the Selected Only parameter on the Report() call.
Should be:
Should be:
Code: Select all
"Create Those Folders"
//Get Location of where Folders will be created.
$dir=InputFolder("<curpath>", "Where would you like to create these folders?");
//Generate and execute a script to create each new item.
Load(Report("New('$dir\{Name}','dir');", 1),, "s");Re: Help ! Create new empty folders
O.K.! It's time for me to get familiar with this 'Report' thinggy. 
-
admin
- Site Admin
- Posts: 64875
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Help ! Create new empty folders
Folks, this is built in! Check Hep for Create Folder(s) Here:
Create Folder(s) Here
Drag a folder (or several folders) onto a target location and create a copy of this folder without any of its contents in the target location. It's the flat version of "Create Branche(s) Here" (below). Very handy feature to quickly create some folders by simply drag-dropping them to their birth-place.
Create Folder(s) Here
Drag a folder (or several folders) onto a target location and create a copy of this folder without any of its contents in the target location. It's the flat version of "Create Branche(s) Here" (below). Very handy feature to quickly create some folders by simply drag-dropping them to their birth-place.
FAQ | XY News RSS | XY X
Re: Help ! Create new empty folders
Thanks. But not as script commandadmin wrote:Folks, this is built in!
Can getinfo or report be extended to working recursive?
-
admin
- Site Admin
- Posts: 64875
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Help ! Create new empty folders
I don't know.Stefan wrote:Thanks. But not as script commandadmin wrote:Folks, this is built in!![]()
Can getinfo or report be extended to working recursive?
FAQ | XY News RSS | XY X
Re: Help ! Create new empty folders
Thank you all for your quick reply and yes indeed, this was build in !
The problem is there are too much (?!) features build in XYplorer to know them all !
Thanks again
Ysl
The problem is there are too much (?!) features build in XYplorer to know them all !
Thanks again
Ysl
Re: Help ! Create new empty folders
I thought it was built-in somewhere but didn't check help.admin wrote:Folks, this is built in! Check Hep for Create Folder(s) Here
I saw it on the d'n'd menu, however, since you haven't given those items descriptions that show up in the status bar I had no clue what they do!
Err.. honestly I didn't even check there.
-
SkyFrontier
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: Help ! Create new empty folders
Is there a way to improve this:
so it can create folders WITHOUT "pseudo-extensions" and based off selected files only, different from current "take all folder's content as base name for new folders" code?
Thanks!
Code: Select all
"Create Those Folders"
//Get Location of where Folders will be created.
$dir=InputFolder("<curpath>", "Where would you like to create these folders?");
//Generate and execute a script to create each new item.
Load(Report("New('$dir\{Name}','dir');", 1),, "s");Thanks!
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Re: Help ! Create new empty folders
That code works already for selected items only.SkyFrontier wrote:Is there a way to improve this:so it can create folders WITHOUT "pseudo-extensions"Code: Select all
"Create Those Folders" //Get Location of where Folders will be created. $dir=InputFolder("<curpath>", "Where would you like to create these folders?"); //Generate and execute a script to create each new item. Load(Report("New('$dir\{Name}','dir');", 1),, "s");
and based off selected files only, different from current "take all folder's content as base name for new folders" code?
Thanks!
To drop the folder "extensions" i had first {BaseName} in mind, but
{Basename}
- The field is set to the base name of the file (file name without extension).
- Folder names are returned unchanged.
So i use an regex here to drop all chars after and included the last dot:
Code: Select all
"Create Those Folders"
//Get Location of where Folders will be created:
$dir=InputFolder("<curpath>", "Where would you like to create these folders?");
//Get the list of selected items, folders or files:
$LIST = Report("{Name}<crlf>", 1);
//For Each Item in Items:
$Loop = 1;
while(1)
{
//Get next ITEM:
$ITEM = gettoken($LIST, $Loop, "<crlf>");
//If ITEM is nothing end this script:
IF ($ITEM==""){break;}
//Get the BASE of the item name, i.e. drop all after including the last dot:
$Folder = regexreplace("$ITEM", "(.+)(\..+)","$1");
//Create new item, here as folder:
new($dir\$Folder, dir);
//next iteration:
incr $Loop;
}
HTH?
-
SkyFrontier
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: Help ! Create new empty folders
Purrrrfect...
Wow.
Works even if base names are taken out of other folders' names and even name collision is avoided appending "-01" as ending.
...now will try to make a simpler version, no-GUI, just a point-and-shoot tools... I love choices!
Thanks, Stefan!
As a side note... take a look at today's Giveaway. It seems a pretty good program. (Don't know if you still check out that site, but... there you go!)
EDIT:
In the event of someone wishing to create a CTB/CKS for it, with no-GUI to interact with (point-and-shoot scripts!
), here it goes:
All credit goes to Stefan.
Wow.
Works even if base names are taken out of other folders' names and even name collision is avoided appending "-01" as ending.
...now will try to make a simpler version, no-GUI, just a point-and-shoot tools... I love choices!
Thanks, Stefan!
As a side note... take a look at today's Giveaway. It seems a pretty good program. (Don't know if you still check out that site, but... there you go!)
EDIT:
In the event of someone wishing to create a CTB/CKS for it, with no-GUI to interact with (point-and-shoot scripts!
Code: Select all
"Create Those Folders"
//Get the list of selected items, folders or files:
$LIST = Report("{Name}<crlf>", 1);
//For Each Item in Items:
$Loop = 1;
while(1)
{
//Get next ITEM:
$ITEM = gettoken($LIST, $Loop, "<crlf>");
//If ITEM is nothing end this script:
IF ($ITEM==""){break;}
//Get the BASE of the item name, i.e. drop all after including the last dot:
$Folder = regexreplace("$ITEM", "(.+)(\..+)","$1");
//Create new item, here as folder:
new($dir\$Folder, dir);
//next iteration:
incr $Loop;
}
Last edited by SkyFrontier on 27 Jul 2010 13:06, edited 1 time in total.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
-
SkyFrontier
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: Help ! Create new empty folders
Stefan,
Is it possible to have this matter handled in another approach?
Script could ask user:
Consider that BackupTEMP_0015 is a starting indicator, so the next "X" will append like:
Base: BackupTEMP_0015; X = 7; Output folders: BackupTEMP_0016...BackupTEMP_0022
Another way to achieve that (if the lasting numbers can't be easily checked by that script) would be asking user for a third input, so:
I was wondering on a more wider range of usage for such script... More USUAL, perhaps.
Thanks much!
EDIT: Ideally this cannot be limited to 4 digit format... "XXXX" or "YYY" is another base indicator. User defined.
Is it possible to have this matter handled in another approach?
Script could ask user:
Code: Select all
Base name ("BackupTEMP_0015", for instance)
Number of folders to be created ("X")Base: BackupTEMP_0015; X = 7; Output folders: BackupTEMP_0016...BackupTEMP_0022
Another way to achieve that (if the lasting numbers can't be easily checked by that script) would be asking user for a third input, so:
Code: Select all
Base name: ("BackupTEMP_", for instance)
Number of folders to be created: ("X")
Starting with: (0015)Thanks much!
EDIT: Ideally this cannot be limited to 4 digit format... "XXXX" or "YYY" is another base indicator. User defined.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
XYplorer Beta Club