Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Move files to the right folder.




On 16 Oct 2006, at 15:14, Mark J. Reed wrote:

The most annoying part of doing that with AppleScript is getting the
leading 0s into the folder names.  :)

In this situation, Mark, I suppose one might argue that any leading zeros are already contained by the file names (assuming, of course, that they're all accurate):


------------
set fileName to "BE_00097_M3200W"
set oldDelim to text item delimiters
set text item delimiters to "_"
tell text 1 thru 3 of fileName's text item 2 to ¬
	set folderName to it & "00-" & it & "99_Vendor_Code"
set text item delimiters to oldDelim
folderName --> "00000-00099_Vendor_Code"
------------

If file names consistently start with 2 characters and "-", then the folder name could be derived even more directly:

------------
set fileName to "BE_00158_M1370"
tell fileName's text 4 thru 6 to set folderName ¬
	to it & "00-" & it & "99_Vendor_Code"
--> "00100-00199_Vendor_Code"
------------

---
kai


_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden
References: 
 >Move files to the right folder. (From: Jan Bultereys <email@hidden>)
 >Re: Move files to the right folder. (From: "Mark J. Reed" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.