Copy file or folder name to clipboard, ignore extension etc

I have some folder like
Folder. artist A [mixed]
Folder. artist B (mixed)

I have some files like
file. artist A (1).flac
file. artist B [remixed].mp4

I need a button for copy the folders and files names only into the clipboard but Ignore all kinds of extension and Ignore everything what is inside in first bracket () and second bracket [] in files and folder names.

Expected Result in folder name is
Folder. artist A
Folder. artist B

Expected Result in folder name is
file. artist A
file. artist B

Hay Dear Community, please help me!

Please Help me someone!!

Dear Community, please help me!

Copy no ext.dcf (304 Bytes)

Clipboard COPYNAMES REGEX "(.+)\.+" "\1"

Is this what you want to do? Let me know... the community is here or you.

Thanks Dear pctechtv for helping me. But This button Copy All the folder path also what I don't want, I want only file or folder names.

Example 1 for FOLDER NAME: "Folder Name A [Demo]" is a folder and it's location is:
D:\Project Secure\Backup v.1 [03-11-2018]\Folder Name A [Demo]
What This button Does :
D:\Project Secure\Backup v.1 [03-11-2018]\Folder Name A
What I want as the result is:
Folder Name A

Example 2 for File NAME: "File Name A [Demo].mp3" is a File and it's location is:
D:\Project Secure\Backup v.1 [03-11-2018]\Folder Name A [Demo]\File Name A [Demo].mp3
What This button Does :
D:\Project Secure\Backup v.1 [03-11-2018]\Folder Name A [Demo]\File Name A [Demo]
See All The path is copied.
What I want as the result is:
File Name A

OK... try this one. Let me know...

Copy N bp.dcf (311 Bytes)

Clipboard COPYNAMES REGEX "(.+)\[|\(.+\]|\)" "\1"

Thank you again Dear pctechtv. here is you feedback.

Feedback 1 for Folder Name:
original path is:
D:\Project Secure\Backup v.1 [03-11-2018]\Folder name A [test]
what the button does:
D:\Project Secure\Backup v.1 [03-11-2018]\Folder name A
What I want is: Folder name A

Feedback 2 for Files Name:
original path is:
D:\Project Secure\Backup v.1 [03-11-2018]\Folder name A [test]\File name A [test] - demo.txt
what the button does:
D:\Project Secure\Backup v.1 [03-11-2018]\Folder name A [test]\File name A
What I want is: File name A

If you don't want the paths, you can remove them easily.

Clipboard COPYNAMES copies the full paths to the clipboard.

Clipboard COPYNAMES=nopaths copies just the names to the clipboard.

The REGEX ... stuff in the two commands above will work with both, so you can put that on the end of the command.

e.g. If you think the last regex in the thread was the right one, then this will do the same thing but without the paths:

Clipboard COPYNAMES=nopaths REGEX "(.+)\[|\(.+\]|\)" "\1"

While regex takes a little time to learn & understand, things like the nopaths parameter are all in the manual and easy to learn/use. :slight_smile:

Thanks Leo for helping...
I use this code: Clipboard COPYNAMES=nopaths REGEX "(.+)\[|\(.+\]|\)" "\1"

but the result is not as expected.
What the button dose: "file name A (test).txt"
What I want as result is: "file name A"

Try this:

Clipboard COPYNAMES=nopaths REGEXP "(.+)\(|\[.+\)|\]" "\1"

Dear Jon I try your code, But your code is not work also. its paste the whole code line only.
what the button does: Clipboard COPYNAMES=nopaths REGEXP "(.+)\(|\[.+\)|\]" "\1"
What I want as result is: "file name A"

That's what I get when I try it here.

My Problem steel not solved, Dear Jon, Leo, Community, please help me!

So if you have:

File name A [test] - demo.txt

You want:

File name A

Is that correct? That contradicts what the first post said:

I'm not sure if you want to remove what's inside [...] and (...) or if you want to remove everything after the first [ or ( including things outside of the brackets.

I am sorry Leo I can't make you understand clearly. Ok fine Let me tell you what I want.

  1. Copy file name only (no path) without it's Extension.
  2. Copy Folder name only (no path)
  3. remove what's inside [...] and (...)
    are you clear now Dear Leo?

Are 1 & 2 strict requirements, as in if a folder is named Test.txt it'd be a problem to remove the .txt from it?

It would probably require a script to apply different search & replace logic to files vs folders. But if you aren't expecting/concerned about folders with dots in their names then it's easier and shouldn't need a script.

Thanks for Replay dear Leo. "Are 1 & 2 strict requirements" Yes it is. But their is nothing to worry in folder name about 'dots'. Dots is only problem in the file name only for their Extension. So it should easier as you tell.

In that case:

Fixed regex:

(.+)(\(|\[).+(\)|\]) ?(.*) to \1\4

Command:

Clipboard COPYNAMES=nopaths REGEXP "(.+)(\(|\[).+(\)|\]) ?(.*)" \1\4

Or this, which does the same thing but removes (...) and [...] using two separate regex instead of a combined one, which might be easier to read. Or not.

Regex:

(.+)\(.+\) ?(.*) to \1\2
(.+)\[.+\] ?(.*) to \1\2

Command:

Clipboard COPYNAMES=nopaths REGEXP "(.+)\(.+\) ?(.*)" \1\2 "(.+)\[.+\] ?(.*)" \1\2

Thanks Dear Leo for helping. But My Problem is not completely solved. Here is your feed back for 2 Code

Clipboard COPYNAMES=nopaths REGEXP "(.+)(\(|\[).+(\)|\]) ?(.*)" \1\4
Clipboard COPYNAMES=nopaths REGEXP "(.+)\(.+\) ?(.*)" \1\2 "(.+)\[.+\] ?(.*)" \1\2

Original Folder name: ABCD [test]
After Using This Code: ABCE
Feed Back: here is a extra Space also paste After the folder name "ABCE (space)" which I don't want. If possible plz remove the extra Space & fix That code.

Original File Name : ABCE (test).txt
After Using This Code: ABCE .txt
Feed Back: Big problem is here is the File Extension. another problem is the extra space After the File name Like the Folder name. Please Remove The File extension & the extra Space with fix the code.