Re: Trouble moving directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



MSFT allowed spaces? They were behind in allowing spaces (and long file names) Apple allowed them far before MS, and Unix allowed spaces far before Apple. Unix just assumes a space is a command/parameter delimiter first and part of the name second. Just like multiplication takes precedence over addition unless you use parenthesis, a space takes precedence as a delimiter unless you use quotes. Spaces are permitted, underscores just means you don't have to use quotes to explain what you mean. It's like saying Unix doesn't allow you to use capitals in the file name because it won't find "filename" it you type "FileName". It's a feature of a case sensitive file system available in most forms of Unix. It also caused a lot of confusion and frustration to people developing web sites under Windows and posting to a Unix host.

Telling users to use underscores is a work around that works as long and everyone uses underscores all the time. It's still better to have knowledge of what's going on and why so when one does encounter a file name with a space they know how to reference it.

I would say one of the lousiest things MSFT did was reversing the / to reference paths in DOS.


On Oct 14, 2005, at 9:28 AM, Miles Thompson wrote:


One of the "nice" things MSFT did was to allow spaces in directory and file names. It created more work for programmers.

One of the LOUSIEST things MSFT did was allowing spaces in directory and file names, because of the needless, tedious parsing and checking it requires.

So much simpler to train users that computers are dumb and trip over spaces, so just use an underscore where you want to separate words. Funny thing, users accept that.

Glad I got that off my chest - Miles

At 10:11 AM 10/14/2005, Brent Baisley wrote:

In your example, the problem is that the name has spaces, which the
shell uses as a delimiter. So "That Won't Move/" is kind of being
considered parameters instead of part of the dir. Using the command
line (i.e. shell/terminal) will give you more feedback as to what is
happening (/some/dir/Dir: No such Directory).

You need to either escape the characters or enclose it in quotes. For
me, I always find it easier to just enclose directory names in quotes.

$source_dir = '"/some/dir/Dir That Won't Move/"';


On Oct 12, 2005, at 10:11 PM, -k. wrote:


I'm having trouble moving some directories. My script works fine on
some directories but doesn't
move others. It seems to have trouble with directories with non
alphanumeric charters. I'm running
Red Hat FC2. I'm trying to move the directory basically like this...

<?Php

$source_dir = '/some/dir/Dir That Won't Move/';
$dest_dir   = '/some/other/dir/'

$cmd = escapeshellcmd("mv ".$source_dir." ".$dest_dir);
$result = shell_exec($cmd);

?>

Is there some way to escape the characters in the directories? For
example if i put a "\" in front
of blank spaces it takes care of those (same for "'","(" etc.) but
that obviously doesn't take
care of everything. I'm hoping there is something easy i'm
overlooking here that will escape all
the characters.




-k.




__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux