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

Home » Public Forums » archive » Creaty dummy.jpeg with Linux command
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
Creaty dummy.jpeg with Linux command [message #90958] Tue, 19 May 2015 01:52 Go to next message
Kai Heckel is currently offline  Kai Heckel
Messages: 51
Registered: April 2015
Member
Hey there!

I'd like to create an empty dummy.jpeg using a Linux command.

What I have is something like this:

jpg_test = FILE_TEST(name+'*.jpg')
IF jpg_test EQ 0 then begin
spawn, 'touch '+file_dirs+'dummy.jpg'
ENDIF

-> "name" = predefined file name
-> "file_dirs" = list of file diretories in which the dummy.jpeg should be copied in.

The command seems right to me but the jpeg does not appear during the process...

Any suggestions?
Thanks
Re: Creaty dummy.jpeg with Linux command [message #90959 is a reply to message #90958] Tue, 19 May 2015 02:03 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Tuesday, May 19, 2015 at 10:52:09 AM UTC+2, Kai Heckel wrote:
> Hey there!
>
> I'd like to create an empty dummy.jpeg using a Linux command.
>
> What I have is something like this:
>
> jpg_test = FILE_TEST(name+'*.jpg')
> IF jpg_test EQ 0 then begin
> spawn, 'touch '+file_dirs+'dummy.jpg'
> ENDIF
>
> -> "name" = predefined file name
> -> "file_dirs" = list of file diretories in which the dummy.jpeg should be copied in.
>
> The command seems right to me but the jpeg does not appear during the process...
>
> Any suggestions?
> Thanks

Well, the command is right, meaning that if I type in a terminal
touch dummy.jpg
I do get the file. Therefore you must have made an error in the directory (file_dirs) and your looking for the file in the wrong place.
Why not just put a
print, file_dirs+'dummy.jpg'
after the spawn command.

My guess: you forgot a forward slash after file_dirs, so that you're actually doing:
touch /home/thisisme/myoutputdummy.jpg
instead of
touch /home/thisisme/myoutput/dummy.jpg

I hope it helps.
Helder
Re: Creaty dummy.jpeg with Linux command [message #90960 is a reply to message #90959] Tue, 19 May 2015 02:20 Go to previous messageGo to next message
Kai Heckel is currently offline  Kai Heckel
Messages: 51
Registered: April 2015
Member
Am Dienstag, 19. Mai 2015 11:03:31 UTC+2 schrieb Helder:
> On Tuesday, May 19, 2015 at 10:52:09 AM UTC+2, Kai Heckel wrote:
>> Hey there!
>>
>> I'd like to create an empty dummy.jpeg using a Linux command.
>>
>> What I have is something like this:
>>
>> jpg_test = FILE_TEST(name+'*.jpg')
>> IF jpg_test EQ 0 then begin
>> spawn, 'touch '+file_dirs+'dummy.jpg'
>> ENDIF
>>
>> -> "name" = predefined file name
>> -> "file_dirs" = list of file diretories in which the dummy.jpeg should be copied in.
>>
>> The command seems right to me but the jpeg does not appear during the process...
>>
>> Any suggestions?
>> Thanks
>
> Well, the command is right, meaning that if I type in a terminal
> touch dummy.jpg
> I do get the file. Therefore you must have made an error in the directory (file_dirs) and your looking for the file in the wrong place.
> Why not just put a
> print, file_dirs+'dummy.jpg'
> after the spawn command.
>
> My guess: you forgot a forward slash after file_dirs, so that you're actually doing:
> touch /home/thisisme/myoutputdummy.jpg
> instead of
> touch /home/thisisme/myoutput/dummy.jpg
>
> I hope it helps.
> Helder

I forgot to mention that I want to do this in IDL.

What file_dirs look like is this --> F:\...\....\name\

So it should put the jpeg below the "name" folder but it doens't
Re: Creaty dummy.jpeg with Linux command [message #90961 is a reply to message #90960] Tue, 19 May 2015 02:29 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Tuesday, May 19, 2015 at 11:20:12 AM UTC+2, Kai Heckel wrote:
> Am Dienstag, 19. Mai 2015 11:03:31 UTC+2 schrieb Helder:
>> On Tuesday, May 19, 2015 at 10:52:09 AM UTC+2, Kai Heckel wrote:
>>> Hey there!
>>>
>>> I'd like to create an empty dummy.jpeg using a Linux command.
>>>
>>> What I have is something like this:
>>>
>>> jpg_test = FILE_TEST(name+'*.jpg')
>>> IF jpg_test EQ 0 then begin
>>> spawn, 'touch '+file_dirs+'dummy.jpg'
>>> ENDIF
>>>
>>> -> "name" = predefined file name
>>> -> "file_dirs" = list of file diretories in which the dummy.jpeg should be copied in.
>>>
>>> The command seems right to me but the jpeg does not appear during the process...
>>>
>>> Any suggestions?
>>> Thanks
>>
>> Well, the command is right, meaning that if I type in a terminal
>> touch dummy.jpg
>> I do get the file. Therefore you must have made an error in the directory (file_dirs) and your looking for the file in the wrong place.
>> Why not just put a
>> print, file_dirs+'dummy.jpg'
>> after the spawn command.
>>
>> My guess: you forgot a forward slash after file_dirs, so that you're actually doing:
>> touch /home/thisisme/myoutputdummy.jpg
>> instead of
>> touch /home/thisisme/myoutput/dummy.jpg
>>
>> I hope it helps.
>> Helder
>
> I forgot to mention that I want to do this in IDL.
>
> What file_dirs look like is this --> F:\...\....\name\
>
> So it should put the jpeg below the "name" folder but it doens't

I got the point that you do this in IDL, but what spawn does is execute your command in the terminal, so you might as well test the command in the terminal and then import the exact same command in idl and use spawn.

It looks to me as if you've been working too long with windows. I also work with windows, but once in a while I do some stuff under linux and as far as I know you have to do the following changes when you use the paths:

windows:
c:\Mydirectory\
linux:
/Mydirectory

You see the differences? Here is a summary
1) linux uses no drive letter. So no "F:"
2) linux uses forward slash "/", windows backward slash "\"
3) because of 1), linux uses a path to address a drive... so something like this:
/myUsbStick/Mydirectory/

Things might be adapted in linux and the above are quite general.

IDL also gives you a hand in getting the right slash. Use the function path_sep() to get the right one automatically. So your IDL path should look like

mySep = path_sep()
myDir = 'home'+mySep+'thisisme'+mySep+'myoutput'+mySep+'dummy.jpg'

cheers
Helder
Re: Creaty dummy.jpeg with Linux command [message #90962 is a reply to message #90961] Tue, 19 May 2015 05:52 Go to previous messageGo to next message
Matthew Argall is currently offline  Matthew Argall
Messages: 286
Registered: October 2011
Senior Member
> mySep = path_sep()
> myDir = 'home'+mySep+'thisisme'+mySep+'myoutput'+mySep+'dummy.jpg'

There is also the FilePath() function. The ROOT_DIR and SUBDIRECTORIES keywords would be useful here.

http://exelisvis.com/docs/FILEPATH.html
Re: Creaty dummy.jpeg with Linux command [message #90980 is a reply to message #90962] Tue, 19 May 2015 23:46 Go to previous message
Kai Heckel is currently offline  Kai Heckel
Messages: 51
Registered: April 2015
Member
Am Dienstag, 19. Mai 2015 14:52:39 UTC+2 schrieb Matthew Argall:
>> mySep = path_sep()
>> myDir = 'home'+mySep+'thisisme'+mySep+'myoutput'+mySep+'dummy.jpg'
>
> There is also the FilePath() function. The ROOT_DIR and SUBDIRECTORIES keywords would be useful here.
>
> http://exelisvis.com/docs/FILEPATH.html

Aloha everyone!

I solved the problem by simply using the IDL function. I know that was not exactly what I asked for, but the result is the same.
I used this function:

write_jpeg, name+'_dummy.jpg', TVRD(), QUALITY=25


Thanks for your help!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Accessing class structure fields outside the class
Next Topic: How to include a scale bar (distance bar) on the Google Map Plot?

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

Current Time: Wed Oct 08 09:22:53 PDT 2025

Total time taken to generate the page: 0.00464 seconds