Creaty dummy.jpeg with Linux command [message #90958] |
Tue, 19 May 2015 01:52  |
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 #90960 is a reply to message #90959] |
Tue, 19 May 2015 02:20   |
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   |
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 #90980 is a reply to message #90962] |
Tue, 19 May 2015 23:46  |
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!
|
|
|