[futurebasic] Re: [xfb] Leading "." in file name /w AppleScript

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2001 : Group Archive : Group : All Groups

From: Charlie Dickman <3tothe4th@...>
Date: Sun, 23 Dec 2001 19:46:16 -0500
On Sunday, December 23, 2001, at 07:31  PM, gnome@... 
wrote:

>
> Le lundi 24 décembre 2001, à 01:27 , Charlie Dickman a écrit :
>
>> I have written an AppleScript to run under OS X that will delete from 
>> the front of file names any digit, space or ".". The problem is that 
>> AS under X does not recognize the leading "." as part of the file's 
>> name; my best guess is that it considers the "." to be an extension 
>> separation character. How would one successfully select a leading "." 
>> in a file's name in OS X?
>
> i'd say that you can't. in x this means a 'hidden' file.
> you can use shell scripts to see these, but you have to explicitely
> request that hidden files show up. i can't remember the command offhand,
> but a common 'nix reference should help you.
>
> if you can launch a shell command from applescript then you should
> be able to do this, and get a list of files as a result.
>
> found it, try "ls -al"
> i believe that the 'a' means 'all', that is, including 'hidden' files.

I understand. In fact, if, in the Finder, you try to set the first 
character of a file's name to a "." it refuses to do it saying that such 
names are reserved for the system. It even objects to deleting the first 
character from a name if that would make the first character a "."; same 
reason.

However, when a filename has an embedded "." and you use an applescript 
to remove the characters in front of the "." you can obtain a 
non-invisible file with a leading "." in its name. I suppose I can check 
for "." as the second character and delete it before or with the first. 
I should think that applescript should not allow the creation of an 
"illegal" filename.

By the way, these names were created by SoundJam MP when ripping tracks 
from a CD. SJ likes to prepend the name with the track number followed 
by ". ".

Charlie Dickman
3tothe4th@...