Hi
Is it possible to copy selected files to their own seperate folders(per file). I would like folders to be named based on files as well.
Copying files to own seperate folders?
Re: Copying files to own seperate folders?
I have no knowledge of scripting it's only the second one I write, but I can offer this humble one line script waiting a better and complete solution
If we have one file selected and his name is hello.ext, it will create a folder called hello and it will copy the file inside it
Code: Select all
$a = <curbase>.'.'.<curext>; new <curbase>, dir; copyto <curbase>, <curpath>.'\'.$a;
-
- Site Admin
- Posts: 60567
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
Re: Copying files to own seperate folders?
Works well it seems! Here's a little simplification using <curname>ale wrote:I have no knowledge of scripting it's only the second one I write, but I can offer this humble one line script waiting a better and complete solution
If we have one file selected and his name is hello.ext, it will create a folder called hello and it will copy the file inside itCode: Select all
$a = <curbase>.'.'.<curext>; new <curbase>, dir; copyto <curbase>, <curpath>.'\'.$a;
Code: Select all
$a = <curname>; new <curbase>, dir; copyto <curbase>, "<curpath>\$a";
FAQ | XY News RSS | XY Twitter
Re: Copying files to own seperate folders?
This is great. I do this sort of thing all the time. I've modified it to work on multiple selections so each selected item will be copied to its own named folder. Of course copyto can just as easily be replaced with moveto which is my preferred action.
I'm just a wee bit proud actually I think I've done pretty well for a relative newbie. I'd love to know if there is a better/shorter method I could have used.
Code: Select all
//creates named folder for each
foreach($file, get("SelectedItemsPathNames", "|"), "|") {
$folder = getpathcomponent($file, "base");
new $folder, dir;
//copies each to named folder
$path = getpathcomponent($file, "path");
$name = getpathcomponent($file, "file");
copyto "$folder", "$path\$name";}
Windows 10 Pro 22H2