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.
|
|
|