On Mon, Jan 19, 2015 at 8:36 PM, Cameron Simpson cs@zip.com.au
[LINUX_Newbies] <LINUX_Newbies@yahoogroups.com> wrote:
> On 19Jan2015 18:20, J <dreadpiratejeff@gmail.com> wrote:
>>Snipped everything but part of Cameron's reply because that's what I'm
>>really commenting about (though the comment is directed at the OP, not
>>Cameron)
>>
>>On Mon, Jan 19, 2015 at 5:54 PM, Cameron Simpson cs@zip.com.au
>>[LINUX_Newbies] <LINUX_Newbies@yahoogroups.com> wrote:
>>
>>> {2009}«{12}«{04}«{PHOTOS}«{Pictures}
>>
>>I'm kinda curious about why the need for {} and << in a file name and
>>path? Given that in BASH and DASH, at least, both are special shell
>>characters, right?
>
> The "«" is a _single_ character, not the "<<" redirection syntax associated
> with here-documents. If the OP can type it easily (I'm using cut/paste myself)
> it is entirely reasonable.
Huh... How do you type that? (Yeah, I know you are using cut/paste)
but how do you type that character in a shell? I had no idea there
was an actual single character that is made up of two <'s
> The { and } are not particularly special. In modern shells, {...,...} _is_
> special as it performs enumeration eg foo{this,that}bah turning into
> "thisfoothat" and "thisbarthat". However, it is _not_ special otherwise.
>
> For example, the find command's placeholder argument:
>
> find . -type f -name '*foo*' -exec echo found foo named {} ';'
>
> does not need any escaping on the shell command line for the {}; it has been so
> for decades.
OK... I thought it did need so. Interestingly, if I do this:
touch {foo}
and then this:
ls {foo}
it works as you say, but if I tab-complete like this:
ls {<TAB>
tab complete does escape it like this:
ls \{foo\}
I've never seen tab complete escape something automatically before...
so another new thing on me.
>>Because to type that out on a shell (which you'd need to do in most
>>scripts, right? maybe not in python, perhaps, but anything that is
>>done in shell) you'd need to escape all that, and end up looking like
>>this when typed in manually:
>>
>># \{2009\}|\<\<\{12\}\<\<\{04\}\<\<\{PHOTOS\}\<\<\{Pictures\}
>
> Really, you don't need to escape _any_ of this at a normal shell prompt.
>
> (Besides, with names that long one would normally use file completion:-)
So as I said above, at least with my shell (Dash in Ubuntu 14.04)
tab-complete does escape all the { and }s, I didn't try adding in that
curious double arrow character.
>
>>Even in sed or awk, I believe you'd need to escape all that, I think.
>
> Nope. Nothing special there.
>>Personally, my photos are all categorized more descriptively (and more
>>shell friendly for times when I need to use a shell script on one or
>>more directories and filenames:
>>
>>/Photography/2014/2014-04-25_Some_Event/raw/2014-04-25_Some_Event-001.raw
>>/Photography//2014/2014-04-25_Some_Event/processed/2014-04-25_Some_Event-001.jpg
>
> Out of curiosity, do you use any specific tools to manage these?
Nope. Each year I create a year directory, and every time I shoot a
new event I save the RAW images as YYYY-MM-DD-Event_Name-SEQNUMBER and
when I process any of them into portable formats like JPEG or GIF or
anything else, they're exported using the same name. And the whole
thing is saved under a folder using the same name...
So:
2014/
../2014-12-25-Christmas/
../raw
../2014-12-25-Christmas-001.raw
FWIW, I do all the initial saving and downloading on a Mac using Adobe
Lightroom but I back everything up to a couple of external USB drives
that are also shared with my linux boxes. So the file naming is done
when I import from my camera. But it's mostly done one event at a
time. And I DO change the dates for shots shot in a different date.
But mostly, I manage it all manually. I only really have to manage it
during the initial import, after that, I keep everything as is, which,
as you mentioned, starting with YYYY-MM-DD is a LOT more sortable than
other ways of file and directory naming.
>>Anyway, point is, if you want to use shell scripts on things, it
>>really pays to not use special shell constructs in the naming
>>convention.
>
> Not if the shell scripts are written robustly. You really shouldn't need to
> care much about the contents of filenames.
>
> That said, personally I avoid whitespace, slashes, and a lot of shell
> punctuation such as "(", ";" etc. (But not "{" so much.)
>
> I even have handy scripts to fold hated filenames into saner filenames, such as
> my "__" script:
>
> https://bitbucket.org/cameron_simpson/css/src/tip/bin-cs/__
>
> which wraps frename:
>
> https://bitbucket.org/cameron_simpson/css/src/tip/bin/frename
>
> Ah, such fun...
>
>>But that's just my opinion...
>
> Cheers,
> Cameron Simpson <cs@zip.com.au>
>
> In My Egotistical Opinion, most people's C programs should be indented six
> feet downward and covered with dirt. - Blair P. Houghton
>
>
> ------------------------------------
> Posted by: Cameron Simpson <cs@zip.com.au>
> ------------------------------------
>
> To unsubscribe from this list, please email LINUX_Newbies-unsubscribe@yahoogroups.com & you will be removed.
> ------------------------------------
>
> Yahoo Groups Links
>
>
>
Posted by: J <dreadpiratejeff@gmail.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (8) |
No comments:
Post a Comment