Page 1 of 1

File2Folder-like function in XY

Posted: 25 May 2022 10:53
by chumbo
I've been using a small script for Windows called File2Folder that does exactly that, creates a folder for 1 or more files and puts those files in that newly-created folder.
There is no GUI, it just creates a single context-menu which, when you select a file and run it, will create a folder based on the name of the file and instantly put that file in that new folder.
If you run it on two or more files, then a menu pops up giving you the option to either move each file to it's own folder - again based on the name of those individual files - or move them all into one folder for which you then can enter a name...that's it!
Simple, super useful and used to work until I recently bought a new PC and I guess with a new version of Windows it has stopped working (confirmed by other users as well) :(

Wouldn't this be possible to do in XY?

Here's the link to the developer's website: https://www.dcmembers.com/skwire/downlo ... -2-folder/
It's his 2nd most downloaded app after....Text2Folder which pretty much already exists in XY as 'New Folders...' context-menu which is why I think this could be a great addition many will find useful! :)

Re: File2Folder-like function in XY

Posted: 25 May 2022 10:54
by highend
And? Write a simple script for it, use a CEA to get a menu entry on right click for it^^

Re: File2Folder-like function in XY

Posted: 25 May 2022 11:47
by chumbo
highend wrote: 25 May 2022 10:54 And? Write a simple script for it, use a CEA to get a menu entry on right click for it^^
Haha, I wish I could (funny how these days everybody assumes one is coder ;)), otherwise, be sure I'd have done so and shared it for all to enjoy!

Re: File2Folder-like function in XY

Posted: 25 May 2022 12:19
by RalphM
Well, standard XY functions already offer to right-drag the selected files to any location (including the current folder) and select move/copy to new subfolder and it then offer the name of the focused file as name for the new folder.
The only thing you are missing of your original request is the part where each file ends up in its own folder.

Re: File2Folder-like function in XY

Posted: 25 May 2022 13:17
by VeeGee
Good morning ! Here is a script that I use in the Hamburger menu. It will "get" a folder name based on the selected file(s), display a preview and, if OK, move the file(s) to the folder(s). I had created an original version and then highend helped me optimize it.

I saved the script into the (\AppData\Roaming\XYplorer\Scripts) folder.
Hamburger menu code :

Code: Select all

::Move File to Folder;load "MoveFileToFolder.xys";
It might not be exactly what you are asking for, but I hope this helps out and can get you started.

Re: File2Folder-like function in XY

Posted: 25 May 2022 13:45
by chumbo
Thx VeeGee but unfortunately I couldn't get it to work as you described. I don't know what is the Hamburger Menu (briefly looked in the Help...unsurprisingly, I didn't understand anything :(), so I just ran the script with some files selected and it just opened the 'Rename' function in XY?

Thx RalphM! That's already half of the functionality taken care of! :appl:

Re: File2Folder-like function in XY

Posted: 25 May 2022 14:28
by VeeGee
Hello !
The hamburger menu is the small three-lined icon on the breadcrumb bar :
Image-001.png
Image-001.png (2.69 KiB) Viewed 2344 times
You can put all kinds of useful commands and scripts in the menu. You right-click, Customize to be able to edit it. IMO, it ranks up there and one of the best additions to XY ever.

I do have the script set (via the preview setting) to display the rename preview box so I can verify that it is correct. This can be disabled by changing this line :

Code: Select all

rename "l", $list, "p", $items, 193
to

Code: Select all

rename "l", $list, , $items, 193
More qualified scripting gurus may jump in and help out here, this is just my simple take on it.

Re: File2Folder-like function in XY

Posted: 25 May 2022 14:30
by FluxTorpedoe
Hi chumbo,

I had the same need so it was one of the first scripts I made a while back — it’s indeed an incredibly useful function, I use it all the time without even thinking about it!

I wanted it as efficient as possible, so it’s just:
Select file(s) > Shift+F (my shortcut) > Done!

There’s no Right-Click or multiple choices, but you can build on it.

Hope this helps,

Flux

———————————————————————————
###   Folderize   ###

• DOWNLOADS:
› Script:
_Manip_Folderize.xys
(1.63 KiB) Downloaded 68 times

• INSTALLATION:
 — Download the script (link above) and copy it into XYplorer scripts folder: <xyscripts> , then
 — Assign a shortcut to it (e.g. for Shift+F):
   XYplorer menu User > Manage Commands... > Load Script File > [New] > Add New Command >
   Caption: Folderize
   Script File: _Manip_Folderize.xys
   > [Assign Keyboard Shortcut] > Shift+F

• HOW TO USE:
 — Select one or more files
 — Press the assigned keyboard shortcut, e.g. Shift+F
 > A new folder will be created (based on the focused file) and all selected files will be moved inside it.

› Tip: Since the name of the focused file is used for the name of the folder, it’s possible to first select a specific file to focus it, then (without pressing any modifier) just lasso around the group of files (the focused file will be distinguished by its dotted frame).

Re: File2Folder-like function in XY

Posted: 25 May 2022 14:51
by chumbo
Brilliant Flux, thx! But if I may say without wanting to offend...this is sort already built-in XY as was explained by RalphM a few posts above.
Agreed your script can be faster by skipping the folder naming window that pops-up with the right-drag but what's still really missing and equally useful is the ability to create multiple folders from multiple files (each folder carrying the name of it's corresponding file).
You never needed that? Highend made a sound like a really simple task for someone who knows how to code so...dunno if you're up to the task, if you find it useful? ;)

Re: File2Folder-like function in XY

Posted: 25 May 2022 15:09
by highend
Last one I've shared
1.png
1.png (26.11 KiB) Viewed 2325 times

Re: File2Folder-like function in XY

Posted: 25 May 2022 15:36
by chumbo
Thx...I guess :veryconfused: ??
I imagine someone will know what to do with this :roll:

Re: File2Folder-like function in XY

Posted: 25 May 2022 19:57
by Filehero
@highend
Is this VSCode?

Re: File2Folder-like function in XY

Posted: 25 May 2022 20:39
by highend
Sublime Text

Re: File2Folder-like function in XY

Posted: 25 May 2022 20:49
by Filehero
Thanks.