Score:1

Changing a folder name that has a space in it

mt flag

I need to Change a folder name Word Press into wordpress. It gives an error because I have mistakenly written the folder name in two parts, which is not recognized as one name. What can I do terminal prompt wise, please?

Score:8
cn flag
raj

You need to escape the space in name. Type

mv "Word Press" wordpress

or

mv Word\ Press wordpress
babs avatar
mt flag
It says file cannot be read. Directory or folder not found.(translation)
babs avatar
mt flag
Does the folder need to be active when doing this?
raj avatar
cn flag
raj
If you get a message "directory not found", you need to use the correct path to the directory. The commands I wrote will work only if your current directory is the parent directory of "Word Press". You should either change to that directory or use full paths in the command.
Score:2
jp flag

To automatically remove spaces in all file/directory names in the current working directory, you can use rename(needs installing) like so:

rename -n 's/ //g' *

Notice: -n is for a dry-run ... Remove it when satisfied with the output and rerun to actually do the renaming.

Or you can use a bash loop like so:

for f in *; do [[ "$f" =~ " " ]] && echo mv -n -- "$f" "${f// /}"; done

Notice: echo is for a dry-run ... Remove it when satisfied with the output and rerun to actually do the renaming.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.