Re: "system" with [ ] in filename
- From: Michael Austin <maustin@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 05 Mar 2009 21:31:05 -0600
Richard wrote:
"Michael Austin" <maustin@xxxxxxxxxxxxxxxxxx> wrote in message news:4o_rl.24253$ZP4.2625@xxxxxxxxxxxxxxxxxxxxxxxRichard wrote:Hi all,
this is keeping me awake for the last days. Can someone shed some light, or point me somewhere else if appropriate?
(Windows XP SP1, Perl v5.8.7 MSWin32-x86-multi-thread)
In a perl script I do this:
$cmd = "convert \"$source\" -resize \"160x160>\" \"${thumbnail_prefix}${photonr}\"";
print "Command for shell is: ".$cmd."\n";
system ($cmd);
This works fine, as long as ${photonr} does NOT contain any square brackets.
If ${photonr} turns out to be for example: IMG_8699[1].jpg then the resulting system command takes an incredible lpng time to complete, something like 5 to 10 minutes. (it does complete in the end...)
If no [] are present, then all is done in around half a second.
This is printed to the screen and looks ok to me:
Command for shell is: convert "C:\wwwroot\images\Import/104 Weekly Pix from Supplier/07-090225 Handicraft Fair2/IMG_8699.jpg" -resize "160x160>" "C:\wwwroot\images\ThumbNails\th_IMG_8699[5].jpg"
The question now is:
Do the [ ] have a special meaning to Perl in this context?
Or should I look for the problem in the way Windows handles the [5] in the filename?
Or anything else to investigate?
I am sort of stuck. :(
Some more info:
The target directory has a lot of files, around 200.000
I used File Monitor (Sysinternals) to trace, and see that this "convert" process is checking LOTS of files but can not find those. Its mostly looking in the current dir (where the script is). Is this an indication of anything?
This has been working for over a year, but has never given this strange behaviour ( as far as I know !!) .
Anyone a hint?
Muchos thanks already,
Richard
an easier solution would be to move this to Linux whereby you would not have this problem ;)
Ok, deal!
Come over and you make it work on Linux.
The Linux machine is right next to this one, so you need only one chair.
I have now narrowed it down to the "convert.exe". It is the ImageMagick convert.
Maybe I try the PerlMagick module see if it makes a diff...
Richard
The only reason that a windows box generates the [n] format is a half-baked attempt to create a new version of the same filename - similar to the VMS OS disk:[dir.subdir]file.ext;version. Most Open Source ports to VMS generally turns this into /disk/dir/subdir/file.ext where the OS will automatically return the latest "version" of the file unless otherwise specified and automatically increments the version upon "creating" a "duplicate" filename. example below: (login.com is similar to autoexec.bat(windows) and .profile (*N*X))
Directory somedevice1:[sometopdir.someusername]
LOGIN.COM;37
LOGIN.COM;36
LOGIN.COM;35
LOGIN.COM;34
LOGIN.COM;33
LOGIN.COM;32
LOGIN.COM;31
LOGIN.COM;30
Total of 8 files.
So, the issue is not just that *Magick convert.exe has a problem dealing with the file name and creating a perceived performance issue, you have an issue where (to me at least - and I could be wrong) the file you are generating - say th_IMG_8699[5].jpg could potentially not be the same image as th_IMG_8699.jpg, th_IMG_8699[1].jpg, th_IMG_8699[2].jpg ....
You now have a "data" issue. While these are unique, but similar names, they potentially do not represent the same image. I do not see your code where you transform/read/determine the filename to be written, but a simple routine to make it entirely unique - without the "[n]" would not be out of the question here and would solve the overall problem - giving you time for submitting a bug report to the *magick folks.
.
- Follow-Ups:
- Re: "system" with [ ] in filename
- From: Richard
- Re: "system" with [ ] in filename
- References:
- "system" with [ ] in filename
- From: Richard
- Re: "system" with [ ] in filename
- From: Michael Austin
- Re: "system" with [ ] in filename
- From: Richard
- "system" with [ ] in filename
- Prev by Date: perl as email client
- Next by Date: Re: CGI query string encoding issue...
- Previous by thread: Re: "system" with [ ] in filename
- Next by thread: Re: "system" with [ ] in filename
- Index(es):
Relevant Pages
|