1

I have copied and pasted a directory of files into another.

The result is now this one development\ /

I do not know what that means? Linux does not even recognize it as a directory now.

Also the owner of this directory is wrong. But when I try to do this chown -R zugul /development, the result is: chown: cannot access `/development': No such file or directory

Looks like something went wrong when I have pasted the copied directory. How can I fix this issue?

1
  • i think the \ is escaping a space. try enclosing the path in double quotes and adding a space Commented Dec 23, 2011 at 18:37

5 Answers 5

1

Your directory name seems to have a space in it.

You can either use quotes:

chown -R zugul "/development /" 

Or you can use escape characters:

chown -R zugul /development\ / 
2
  • ok but how do I fix the space issue? I cannot even see it the folder live. It fires a 404 error.. Commented Dec 23, 2011 at 18:42
  • 1
    mv "/development " "/development". Or you can add %20 to your URL: foo.com/development%20 Commented Dec 23, 2011 at 18:42
1

Your directory name ends with a space (probably a regular space, but it could be some other blank character like an unbreakable space). Depending on what options you passed to ls, the \ either is in the file name or indicates that the next character is to be interpreted literally as part of the file name.

You'll want to rename the directory:

mv /development\ /development 

(note the two consecutive spaces: the first is part of the file name and quoted by the preceding backslash, and the second space separates the two arguments). Or

mv '/development ' /development 

If there is already a directory called /development, move the files from the /development ​ directory to /development then remove the badly-named directory (rmdir '/development '). Watch out for conflicts (files existing in both).

Once you've settled the naming issue, take care of other things such as ownership.

0

The filename is incorrect when you try to chown; try instead chown -R zugul development\\\ /.

0

Don't think this belongs to stackoverflow but basically you can do one of 2 things:

chown -R zugul /development* 

If you have multiple /development directories it's a problem. Or

chown -R zugul "/development /" 

In general though you might want to avoid making "development" directories part of the / level. These usually belong to /home/zugul/ somewhere.

Unless you copied the folder as root you won't see it in /. So either your operation failed or the folder in some other directory. If it is in some other directory then you need to do:

cd <dest directory> sudo chown -R zugul "development /" 
2
  • ok but how do I fix the space issue? I cannot even see it the folder live. It fires a 404 error.. Commented Dec 23, 2011 at 18:42
  • See the edit to the answer. I think you have confused things a little bit. It seems you are mixing the UNIX/Linux shell with Web Access. So you might want to clarify the issue before continuing. Commented Dec 23, 2011 at 18:44
0

Instead of guessing what the character is, use something that quotes the special chars. I like this method:

ls --quoting-style=shell-escape

That shows what it actually is (using bash/ksh-style $'' strings which handle ANSII C escapes). As a bonus, that should give you a pre-quoted string that you can directly pass to chown or whatever else you need to do in the shell. For example, here's a file with a newline in the name, showing the ls output and then using the pre-quoted ls output for chgrp and rm:

sauer@lightning:/tmp/test> ls -l total 0 -rw-r--r-- 1 sauer users 0 Aug 14 17:04 a?file sauer@lightning:/tmp/test> ls -l --quoting-style=shell-escape total 0 -rw-r--r-- 1 sauer users 0 Aug 14 17:04 'a'$'\n''file' sauer@lightning:/tmp/test> chgrp docker 'a'$'\n''file' sauer@lightning:/tmp/test> ls -l --quoting-style=shell-escape total 0 -rw-r--r-- 1 sauer docker 0 Aug 14 17:04 'a'$'\n''file' sauer@lightning:/tmp/test> rm -v 'a'$'\n''file' removed 'a'$'\n''file' 

I'd suggest renaming the file to something without weird chars. :)

sauer@lightning:/tmp/test> ls a??file sauer@lightning:/tmp/test> ls --quoting-style=shell-escape 'a'$'\t\033''file' sauer@lightning:/tmp/test> mv -v 'a'$'\t\033''file' regular_filename renamed 'a'$'\t\033''file' -> 'regular_filename' 

You must log in to answer this question.