Tips for IDL-istic file transfer...? Please help me. [message #70845] |
Mon, 10 May 2010 01:55  |
Harry Kim
Messages: 16 Registered: April 2010
|
Junior Member |
|
|
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 #70899 is a reply to message #70845] |
Wed, 12 May 2010 14:00  |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
Harry Kim 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.
The question's been answered, but IDL isn't the ideal (pun intended :o) tool here... IMO
at least. What about:
#!/bin/sh
old_dirs=`ls -d 20??.*`
new_dir="2000-2008"
test -d ${new_dir} || mkdir ${new_dir}
for dir in ${old_dirs}; do
mv ${dir}/* ${new_dir}
done
in regular old shell??
Disregard if you're a windows user of course....
cheers,
paulv
|
|
|
Re: Tips for IDL-istic file transfer...? Please help me. [message #70907 is a reply to message #70845] |
Wed, 12 May 2010 04:28  |
Wout De Nolf
Messages: 194 Registered: October 2008
|
Senior Member |
|
|
On Wed, 12 May 2010 13:23:23 +0200, Wox <spam@nomail.com> wrote:
> 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
>
>
On second thought, when you have only one year, you can omit the
stregex. This was only necessary to extract the years 2000 till 2008
from all 200? years (i.e. omitting 2009)
Pro Movefile_051110
source=file_search('D:\MODIS11\Data\MYD11A1.005\2007.??.??\' ,'*.*')
path='D:\MODIS11\Data\\MYD11A1.005\2007\'
file_mkdir,path
file_move,source,path+file_basename(source)
end
|
|
|