PCman can't open files with spaces in the name

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
TheBigH
Level 1
Level 1
Posts: 20
Joined: Sat Jun 09, 2012 5:24 am

PCman can't open files with spaces in the name

Post by TheBigH »

If my file is called /path/to/directory/Herp Derp.txt

then PCman will refuse to open it, saying
"Failed to open child process /path/to/directory/Herp (No such file or directory)"

My guess is that it's trying to open something called Herp, with Derp.txt as a command line argument.

How do I fix this problem?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
cwsnyder

Re: PCman can't open files with spaces in the name

Post by cwsnyder »

You might try renaming the file without the space in the name by right-clicking on the name and selecting Rename from the context menu in PCManfm.

If that doesn't work, you can do it from the terminal by using cd to move to the folder containing the file and then using the command mv "Herp Derp.txt" Herp_Derp.txt to rename the file.
TheBigH
Level 1
Level 1
Posts: 20
Joined: Sat Jun 09, 2012 5:24 am

Re: PCman can't open files with spaces in the name

Post by TheBigH »

That's not really an option. I have too many files to rename them all, it'd take me forever. Besides, why should I have to? Why can't PCman do what it's meant to do?
abnvolk

Re: PCman can't open files with spaces in the name

Post by abnvolk »

You must use the escape character before the space. For example pcmanfm My\ Folder to open "My Folder". Alternatively type pcmanfm "My Folder".
cwsnyder

Re: PCman can't open files with spaces in the name

Post by cwsnyder »

TheBigH wrote:That's not really an option. I have too many files to rename them all, it'd take me forever. Besides, why should I have to? Why can't PCman do what it's meant to do?
It is doing exactly what it is designed to do. Linux file name conventions don't pay any attention to extensions and can be any length. Linux applications pay attention to the content of a file. A space is used by Linux to delineate a break between file names unless it is either escaped by a \ or entered as a %20. You can also use PCManfm to move the files, however they are named, by drag & drop. The only thing you can't do is to simply double-click on a file to open it if you use a space in the name.

The fault is not in PCManfm, it is in your use of PCManfm.
TheBigH
Level 1
Level 1
Posts: 20
Joined: Sat Jun 09, 2012 5:24 am

Re: PCman can't open files with spaces in the name

Post by TheBigH »

That seems like more of a misfeature actually. There's plenty of reasons why you might end up with lots of files with spaces in their names, so it's unhelpful to say "Just don't have spaces in file names, the computer's right and you're wrong, so nergh". In my case it's because I've saved a list of mobile phone contacts from a friend's phone that was dying, and they've come out as over 200 individual files with names like "John Smith.txt" or "Jane Doe Home.txt".

It seems to me that an intelligent file manager should be able to interpret a group of space-separated things as a single file name if it can't successfully interpret them as a single word command followed by command line arguments.

If PCmanfm won't do what I want I may need to remove it and install one that has this simple, sensible ability. Are there any good ones that can do it?
altair4
Level 20
Level 20
Posts: 11426
Joined: Tue Feb 03, 2009 10:27 am

Re: PCman can't open files with spaces in the name

Post by altair4 »

Just so I understand the nature of the problem, you are double clicking a file with a space in it's name and you are getting that error?

Not sure why but I have PCManFM installed on my Xubuntu 12.04 box and it doesn't exhibit that behavior. I just installed it in a Mint14 Cinnamon VBox guest and it doesn't do it there either.

And in both cases I made it harder since the path was /home/altair/Test Folder/test file.txt

Maybe it's not PCManFM that is the culprit - could it be your default text editor?
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
TheBigH
Level 1
Level 1
Posts: 20
Joined: Sat Jun 09, 2012 5:24 am

Re: PCman can't open files with spaces in the name

Post by TheBigH »

altair4 wrote:Just so I understand the nature of the problem, you are double clicking a file with a space in it's name and you are getting that error?
Yes, that's right.
Maybe it's not PCManFM that is the culprit - could it be your default text editor?
I just tested that idea now, and it's definitely the file manager because it chokes on directory names with spaces as well.
cwsnyder

Re: PCman can't open files with spaces in the name

Post by cwsnyder »

It could also be the version of PCmanFM which you have vs. the one in Ubuntu. Just for giggles, I tried in Thunar 1.2.3 (Debian Wheezy Xfce) with a file with multiple spaces in the name, and it opened mousepad with no problems.
Locked

Return to “Beginner Questions”