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

Home » Public Forums » archive » Create folder below certain file
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
Create folder below certain file [message #90849] Tue, 28 April 2015 04:58 Go to next message
Kai Heckel is currently offline  Kai Heckel
Messages: 51
Registered: April 2015
Member
Hello everyone!

I am currently working on an IDL project in which I want to find a specified file. Once I set the definition for my "IF"-statement, I want to create a new folder below the file...

So this is basically what it looks like:

IF (substring_month EQ '01') then begin
FILE_MKDIR, '/January'
FILE_MOVE, dirname[k], 'January'
ENDIF


This block is part of a "FOR"-loop, which defines "dirname" as the name of a folder.

I'd really appreciate your help!


Thanks everyone
Re: Create folder below certain file [message #90850 is a reply to message #90849] Tue, 28 April 2015 08:02 Go to previous messageGo to next message
Phillip Bitzer is currently offline  Phillip Bitzer
Messages: 223
Registered: June 2006
Senior Member
On Tuesday, April 28, 2015 at 6:58:27 AM UTC-5, Kai Heckel wrote:
> Hello everyone!
>
> I am currently working on an IDL project in which I want to find a specified file. Once I set the definition for my "IF"-statement, I want to create a new folder below the file...
>
> So this is basically what it looks like:
>
> IF (substring_month EQ '01') then begin
> FILE_MKDIR, '/January'
> FILE_MOVE, dirname[k], 'January'
> ENDIF

Well, '/January' specifies the root directory. To create a new directory in the current working directory, use './January' instead.

Of course, this assumes the current working directory is where you find the specified file. A more robust piece of code would parse the result from whatever function you use to find the file.
Re: Create folder below certain file [message #90859 is a reply to message #90849] Tue, 28 April 2015 22:52 Go to previous messageGo to next message
Kai Heckel is currently offline  Kai Heckel
Messages: 51
Registered: April 2015
Member
Am Dienstag, 28. April 2015 13:58:27 UTC+2 schrieb Kai Heckel:
> Hello everyone!
>
> I am currently working on an IDL project in which I want to find a specified file. Once I set the definition for my "IF"-statement, I want to create a new folder below the file...
>
> So this is basically what it looks like:
>
> IF (substring_month EQ '01') then begin
> FILE_MKDIR, '/January'
> FILE_MOVE, dirname[k], 'January'
> ENDIF
>
>
> This block is part of a "FOR"-loop, which defines "dirname" as the name of a folder.
>
> I'd really appreciate your help!
>
>
> Thanks everyone

Hey!

Thanks Philip!

It would't be a problem to create a folder in the working directory. As I am searching for a specified string of a subfolder in a sub directory of my working directory I would need to specify that path in some way.
So once I have found a fitting string in the subfolder would it be possible to overwrite the working directory with that path? Because then I could easyile create the folder in the desired position.

Cheers Kai
Re: Create folder below certain file [message #90860 is a reply to message #90849] Wed, 29 April 2015 01:26 Go to previous messageGo to next message
Kai Heckel is currently offline  Kai Heckel
Messages: 51
Registered: April 2015
Member
Am Dienstag, 28. April 2015 13:58:27 UTC+2 schrieb Kai Heckel:
> Hello everyone!
>
> I am currently working on an IDL project in which I want to find a specified file. Once I set the definition for my "IF"-statement, I want to create a new folder below the file...
>
> So this is basically what it looks like:
>
> IF (substring_month EQ '01') then begin
> FILE_MKDIR, '/January'
> FILE_MOVE, dirname[k], 'January'
> ENDIF
>
>
> This block is part of a "FOR"-loop, which defines "dirname" as the name of a folder.
>
> I'd really appreciate your help!
>
>
> Thanks everyone


I found a solution for my problem.

By simply cutting the path using STRMID and saving it into a variable it is possible to refer to this path later.
Re: Create folder below certain file [message #90863 is a reply to message #90860] Wed, 29 April 2015 11:51 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 4/29/15 2:26 AM, Kai Heckel wrote:
> Am Dienstag, 28. April 2015 13:58:27 UTC+2 schrieb Kai Heckel:
>> Hello everyone!
>>
>> I am currently working on an IDL project in which I want to find a
>> specified file. Once I set the definition for my "IF"-statement, I
>> want to create a new folder below the file...
>>
>> So this is basically what it looks like:
>>
>> IF (substring_month EQ '01') then begin FILE_MKDIR, '/January'
>> FILE_MOVE, dirname[k], 'January' ENDIF
>>
>>
>> This block is part of a "FOR"-loop, which defines "dirname" as the
>> name of a folder.
>>
>> I'd really appreciate your help!
>>
>>
>> Thanks everyone
>
>
> I found a solution for my problem.
>
> By simply cutting the path using STRMID and saving it into a variable
> it is possible to refer to this path later.
>

FILE_BASENAME, FILE_DIRNAME, and FILEPATH might be handy here, instead
of having to use STRPOS and STRMID.

-Mike
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Resolve_all behaves differently on that command line that in the IDE console
Next Topic: How multiply two arrays in IDL?

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

Current Time: Wed Oct 08 11:36:31 PDT 2025

Total time taken to generate the page: 0.00512 seconds