PDA

View Full Version : problems with system("copy");


X-Tender
03-11-2003, 09:33 PM
Ho,

i try the following

string $source = "c:/test/test.jpg";
string $dest = "c:/damn/";
system ("copy \"" + $source + "\" " + "\"" + $dest + "\"");


but it dont work .

fif anyone know why? ..

if i change the path from c:/test/test.jpg int c:\\test\\test.jpg it works .. so maybe it is possible to convert the path --

bigfatMELon
03-12-2003, 07:22 AM
Yes.

First, DOS doesn't use forward slashes. You can use forward slashes to define paths for MEL because Maya converts them internally as needed. But with the system command, you are speaking directly to DOS so you have to use it's syntax.

Second, in order to define a backslash within a string in MEL, you have escape that character. The backslash IS the special chracter used by MEL to escape other characters as you have done with the " character. This is why specifying "\\" will work.

-jl

Razvan
03-12-2003, 07:25 AM
Originally posted by X-Tender
.. so maybe it is possible to convert the path --

It is, check out `toNativePath` command.

X-Tender
03-12-2003, 08:08 AM
Wohoo .. it works :P ...

nendo
03-12-2003, 08:39 AM
Hi !

I have a problem too, but only when i have a "space" in
my destination directory which is "Program Files" ,
Otherwise everything works well !

Any clue ?

bigfatMELon
03-12-2003, 08:44 AM
You can specify DOS paths that include a space by encasing the entire path in quotes like so:

"\"c:\\my crazy name\\folder\""

-jl

nendo
03-12-2003, 09:18 AM
Many thanks bigfatMELon !
it works !:)

mark_wilkins
03-12-2003, 08:00 PM
You can also escape the spaces:


"c:\\my\ crazy\ name\\folder"

-- Mark

nendo
03-19-2003, 01:02 PM
Thank you Mark !

PolyMangler
10-21-2004, 07:49 PM
You can also escape the spaces:


"c:\\my\ crazy\ name\\folder"

-- Mark

Ooookay i need a lil help right now.... this is me :banghead: ...I'm trying to run smedge from the system command this is my command line system("c:\\Program\ Files\\smedge\\smedge.exe");

and this is my result...

Result: 'C:\Program' is not recognized as an internal or external command,


what gives?

Thanks all I read your book Mark...and aside from this lil hiccup it's made mel very useful for me Kuddos my man.

nurcc
10-22-2004, 07:09 AM
Replace

system("c:\\Program\ Files\\smedge\\smedge.exe");

with

system("\"c:\\Program\ Files\\smedge\\smedge.exe\"");

or

system("\"c:\\Program Files\\smedge\\smedge.exe\"");

or

system("c:\\Progra~1\\smedge\\smedge.exe");

The ~1 thing is a throwback to the old 8.3 naming standard. If you want, dir /x will give you the 8.3 equivalent to the long file name.

PolyMangler
10-22-2004, 03:16 PM
Replace

system("c:\\Program\ Files\\smedge\\smedge.exe");

with

system("\"c:\\Program\ Files\\smedge\\smedge.exe\"");

or

system("\"c:\\Program Files\\smedge\\smedge.exe\"");

or

system("c:\\Progra~1\\smedge\\smedge.exe");

The ~1 thing is a throwback to the old 8.3 naming standard. If you want, dir /x will give you the 8.3 equivalent to the long file name.


Thank ya sir! workin like a charm ;)

strarup
12-04-2004, 05:16 PM
Hi,

you can also use Maya melcommand sysFile, instead of the system command... :)

e.g. like this... -->

string $source = "c:/test/test.jpg";
string $dest = "c:/damn/";

sysFile -copy $dest $source;


regards

Alex

CGTalk Moderation
01-14-2006, 02:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.