comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Tips for IDL-istic file transfer...? Please help me.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Tips for IDL-istic file transfer...? Please help me. [message #70821] Tue, 11 May 2010 07:01 Go to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
That indicates that your where() is not finding anything. You should
test the number of indexes found, which is already going into n.

By the way, if you are using stregex just to test if a match is found,
it is cleaner to give it the boolean keyword. That way it already
returns true or false, getting rid of the need to test if the position
is -1:

ind=where(stregex(...,/boolean),n)
Re: Tips for IDL-istic file transfer...? Please help me. [message #70828 is a reply to message #70821] Tue, 11 May 2010 00:05 Go to previous messageGo to next message
Harry Kim is currently offline  Harry Kim
Messages: 16
Registered: April 2010
Junior Member
Thank you very much for your suggestion. However I still got stuck.

Everytime I tried this way, I got this error message.

% Attempt to subscript SOURCE with IND is out of range.
% Execution halted at: MOVEFILE_051110 5 D:\MODIS11\MOD11_Workspace
\Default\movefile_051110.pro
% $MAIN$

Any other suggestions?


This is what I have done so far based on your suggestion. Thanks
again, in advance.
-----------------------------
Pro Movefile_051110

source=file_search('D:\MODIS11\Data\MYD11A1.005\2007.??.??\' ,'*.*')
ind=where(stregex(source,'D:\MODIS11\Data\MYD11A1.005\200[7] ') ne
-1,n)
source=source[ind]
path='D:\MODIS11\Data\\MYD11A1.005\2007\'
file_mkdir,path
file_move,source,path+file_basename(source)

end
Re: Tips for IDL-istic file transfer...? Please help me. [message #70842 is a reply to message #70828] Mon, 10 May 2010 04:18 Go to previous messageGo to next message
Wout De Nolf is currently offline  Wout De Nolf
Messages: 194
Registered: October 2008
Senior Member
On Mon, 10 May 2010 02:01:09 -0700 (PDT), Harry Kim
<kim4ecohydro@gmail.com> wrote:

> "I want to move the files in these folders into one FOLDER named
> '2000-2008'."

If there is no danger for duplicate filenames, you can do something
like this (test it first!!):

source=file_search('C:\tmp\200?.??.??\','*.*')
ind=where(stregex(source,'C:\\tmp\\200[0-8]') ne -1,n)
source=source[ind]
path='C:\tmp\2000-2008\'
file_mkdir,path
file_move,source,path+file_basename(source)
Re: Tips for IDL-istic file transfer...? Please help me. [message #70844 is a reply to message #70842] Mon, 10 May 2010 02:01 Go to previous messageGo to next message
Harry Kim is currently offline  Harry Kim
Messages: 16
Registered: April 2010
Junior Member
"I want to move the files in these folders into one FILE named
'2000-2008'."

This sentence indicates that I am getting stupid... (T.T) What I was
trying to write was...


"I want to move the files in these folders into one FOLDER named
'2000-2008'."

Sorry for the confusion. Please let me know if you have any solution.
Thanks.

Harry


On May 10, 5:55 pm, Harry Kim <kim4ecohy...@gmail.com> wrote:
> Hi, all! I need your help. I have about 3200 folders. Each folder has
> 2 or 8 files in there.
>
> I am trying to move files in those folders into one folder.
>
> the folder's names are as follows.
>
> '2000.01.01', '2000.01.02', '2000.01.03'... ,'2008.12.31'.
>
> I want to move the files in these folders into one file named
> '2000-2008'.
>
> After I have been repeating to open one folder, to cut files, and to
> copy them into one folder for 15 minutes manually, I feel very stupid.
> I think there must be some way in IDL, but I cannot figure out what to
> do.
>
> Can someone get me out of this stupidity? Please let me know an IDL-
> istic solution for this problem.
>
> Thanks.
>
> Harry
Re: Tips for IDL-istic file transfer...? Please help me. [message #70908 is a reply to message #70828] Wed, 12 May 2010 04:23 Go to previous message
Wout De Nolf is currently offline  Wout De Nolf
Messages: 194
Registered: October 2008
Senior Member
On Tue, 11 May 2010 00:05:53 -0700 (PDT), Harry Kim
<kim4ecohydro@gmail.com> wrote:

> Thank you very much for your suggestion. However I still got stuck.
>
> Everytime I tried this way, I got this error message.
>
> % Attempt to subscript SOURCE with IND is out of range.
> % Execution halted at: MOVEFILE_051110 5 D:\MODIS11\MOD11_Workspace
> \Default\movefile_051110.pro
> % $MAIN$


Mind the double "\\" in the stregex input. Also "200[7]" can just be
written "2007". The square brackets indicate a range (e.g. from 0 to
8). Since you one have one number, you can omit the range:


Pro Movefile_051110
source=file_search('D:\MODIS11\Data\MYD11A1.005\2007.??.??\' ,'*.*')
ind=where(stregex(source,'D:\\MODIS11\\Data\\MYD11A1.005\\20 07')
ne-1,n)
source=source[ind]
path='D:\MODIS11\Data\\MYD11A1.005\2007\'
file_mkdir,path
file_move,source,path+file_basename(source)
end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Possible to get name of current procedure from within procedure?
Next Topic: SST data

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:33:46 PDT 2025

Total time taken to generate the page: 0.00694 seconds