FILE_MOVE - FILE_COPY [message #81801] |
Fri, 26 October 2012 02:16  |
titan
Messages: 59 Registered: March 2006
|
Member |
|
|
Hi all,
I'm experiencing a strange behavior of IDL when using FILE_MOVE and FILE_COPY and I'm not able to understand what is going on (probably because it's Friday:)).
I would like to rename a file.
for example:
fname=test_0.txt
new_fname= test_1.txt
Considering what is written in the IDL help it should be enough to do something like this:
"FILE_MOVE, fname, new_fname"
but when I try to do this I got the following error:
"FILE_MOVE: Destination must be a directory. File: test_1.txt"
I get the same error even if I try to move and rename the file to a new directory where I have write permissions.
FILE_MOVE, fname, output_path+new_fname
I have already used in this way this routine but I don't know why I'm facing this problem now.
The same is with FILE_COPY.
Does anybody know any suggestions/workarounds for this?
thanks in advance
|
|
|
Re: FILE_MOVE - FILE_COPY [message #81883 is a reply to message #81801] |
Mon, 29 October 2012 00:42  |
titan
Messages: 59 Registered: March 2006
|
Member |
|
|
>
>> I'm sure that it is a scalar because if I try printing the variable I get only one value.
>
>
>
> Uh, that is not a good way to tell if it is a scalar. Try
>
> using the HELP command. :-)
>
>
>
> Cheers,
>
>
>
> David
>
Hi all,
you were right! It was my mistake!
thanks Ben and thanks David for your suggestions!! I was my mistake and it was not a scalar!
Now it's working! :)
thanks again!!
|
|
|
Re: FILE_MOVE - FILE_COPY [message #81896 is a reply to message #81801] |
Fri, 26 October 2012 07:38  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
titan writes:
> I'm sure that it is a scalar because if I try printing the variable I get only one value.
Uh, that is not a good way to tell if it is a scalar. Try
using the HELP command. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
|
|
|
Re: FILE_MOVE - FILE_COPY [message #81897 is a reply to message #81801] |
Fri, 26 October 2012 07:34  |
titan
Messages: 59 Registered: March 2006
|
Member |
|
|
On Friday, October 26, 2012 3:21:45 PM UTC+2, ben.bighair wrote:
> On Friday, October 26, 2012 5:16:29 AM UTC-4, titan wrote:
>
>> Hi all,
>
>>
>
>> I'm experiencing a strange behavior of IDL when using FILE_MOVE and FILE_COPY and I'm not able to understand what is going on (probably because it's Friday:)).
>
>>
>
>>
>
>>
>
>> I would like to rename a file.
>
>>
>
>>
>
>>
>
>> for example:
>
>>
>
>>
>
>>
>
>> fname=test_0.txt
>
>>
>
>> new_fname= test_1.txt
>
>>
>
>>
>
>>
>
>> Considering what is written in the IDL help it should be enough to do something like this:
>
>>
>
>>
>
>>
>
>> "FILE_MOVE, fname, new_fname"
>
>>
>
>>
>
>>
>
>> but when I try to do this I got the following error:
>
>>
>
>>
>
>>
>
>> "FILE_MOVE: Destination must be a directory. File: test_1.txt"
>
>>
>
>>
>
>>
>
>> I get the same error even if I try to move and rename the file to a new directory where I have write permissions.
>
>>
>
>>
>
>>
>
>> FILE_MOVE, fname, output_path+new_fname
>
>>
>
>>
>
>>
>
>> I have already used in this way this routine but I don't know why I'm facing this problem now.
>
>>
>
>>
>
>>
>
>> The same is with FILE_COPY.
>
>>
>
>
>
> Hi,
>
>
>
> The documentation* for FILE_MOVE says the destination must be a directory if the source points to more than one file.
>
>
>
> "If more than one file is to be moved to a given destination, that destination must exist and be a directory."
>
>
>
> Are you sure-sure-sure that 'fname' is a scalar? You might try...
>
>
>
> FILE_MOVE, fname[0], new_fname
>
>
>
> Cheers,
>
> Ben
>
>
>
> * http://www.exelisvis.com/docs/FILE_MOVE.html (online - woooohooooo!)
Hi Ben,
I'm sure that it is a scalar because if I try printing the variable I get only one value.
|
|
|
Re: FILE_MOVE - FILE_COPY [message #81900 is a reply to message #81801] |
Fri, 26 October 2012 06:21  |
ben.bighair
Messages: 221 Registered: April 2007
|
Senior Member |
|
|
On Friday, October 26, 2012 5:16:29 AM UTC-4, titan wrote:
> Hi all,
>
> I'm experiencing a strange behavior of IDL when using FILE_MOVE and FILE_COPY and I'm not able to understand what is going on (probably because it's Friday:)).
>
>
>
> I would like to rename a file.
>
>
>
> for example:
>
>
>
> fname=test_0.txt
>
> new_fname= test_1.txt
>
>
>
> Considering what is written in the IDL help it should be enough to do something like this:
>
>
>
> "FILE_MOVE, fname, new_fname"
>
>
>
> but when I try to do this I got the following error:
>
>
>
> "FILE_MOVE: Destination must be a directory. File: test_1.txt"
>
>
>
> I get the same error even if I try to move and rename the file to a new directory where I have write permissions.
>
>
>
> FILE_MOVE, fname, output_path+new_fname
>
>
>
> I have already used in this way this routine but I don't know why I'm facing this problem now.
>
>
>
> The same is with FILE_COPY.
>
Hi,
The documentation* for FILE_MOVE says the destination must be a directory if the source points to more than one file.
"If more than one file is to be moved to a given destination, that destination must exist and be a directory."
Are you sure-sure-sure that 'fname' is a scalar? You might try...
FILE_MOVE, fname[0], new_fname
Cheers,
Ben
* http://www.exelisvis.com/docs/FILE_MOVE.html (online - woooohooooo!)
|
|
|