Creating folder from filename & copy contents there

Hi, i´d like to help someone from the german forum with a problem. Following challenge:

  1. selecting a file (he can do this using #_*, as he found out)
    e.g. file01.jpg ist selected, (file02.jpg & file03.jpg are also there)

  2. copy the name of that file into the clipboard (using nopaths) for using it for the folder yet to be created. So the name of the new folder in this case would be file01. It should be one level higher.

  3. all files from the initial folder (file01.jpg, file02.jpg & file03.jpg) should be copied into the new folder "file01".

I already suggested

Clipboard COPYNAMES=nopaths REGEXP (.).[^.] \1
CreateFolder FROMCLIPBOARD

for the part of the folder creation from the clipboard, but have not much of an idea how to exactly solve the other thing in one button.

Maybe:

@nofilenamequoting
Copy HERE CREATEFOLDER="{o|noext}"

This will copy each selected file into a separate folder based on it's name... Not sure if you were looking for something to copy "multiple" files into a "single" new folder.

[quote="steje"]Maybe:

@nofilenamequoting
Copy HERE CREATEFOLDER="{o|noext}"

This will copy each selected file into a separate folder based on it's name... Not sure if you were looking for something to copy "multiple" files into a "single" new folder.[/quote]

Thanks steje. That´s not it yet. The guy wants something like this:

(Basic Folder)

File01
File02
File03

That´s the content of his folder, he selected the first file in order to have the desired folder name from it. That new folder should be one level higher than "basic folder", so if he had the files in

C:\something\basic folder

he wants to have the new folder as

C:\File01

that is one level higher & is containing all three files File01, File02, & File03.

Or shorter: this is what he wants.

@firstfileonly Copy * HERE CREATEFOLDER ..\{o}

[quote="jon"]@firstfileonly Copy * HERE CREATEFOLDER ..\{o}[/quote]

Thanks guys, that´s it. Having added the noext argument, this is what he wanted. Cool.

FYI: the Copy * will copy all files and folders into the new folder - not just those selected. But without it, the @firstfileonly will make it so that ONLY the first selected file will be copied...

It's a bit of a hack but you can use this to only copy the selection:

@nodeselect @firstfileonly dopusrt /CMD Copy HERE CREATEFOLDER ..\{o|noext}

In theory you should be able to use @set to avoid the need for dopusrt and the other stuff but I had a problem getting that to work in this case. Would need to look at it more, but the version above seems to work even if it isn't pretty.

That's what he asked for...

Well, actually the guy asked for each selected file to have it´s own folder, containing the name giving file, as he pointed out recently.

Sorry for this, but his original post was written very circumstantial & complicated, as he didn´t just said what he wanted, but described his own approaches & ideas, hence this wasn´t said clearly.

So the solution would be a button using simply

Rename REGEXP PATTERN "(.)(..)" to "\1\\0"

Thanks to all, i have learned some more interesting REGEX things again.