[Tutor] ls *.py[co] >> .hidden
Albert-Jan Roskam
fomcl at yahoo.com
Thu May 21 18:28:54 CEST 2015
----- Original Message -----
> From: Steven D'Aprano <steve at pearwood.info>
> To: tutor at python.org
> Cc:
> Sent: Thursday, May 21, 2015 6:11 PM
> Subject: Re: [Tutor] ls *.py[co] >> .hidden
>
> On Thu, May 21, 2015 at 03:54:20PM +0100, Bod Soutar wrote:
>
>> ls *.pyc *.pso >> .hidden
>>
>> should work
> [...]
>> As this adds specific results of ls you will need to schedule the
>> command through cron to get it to automatically add new files
>
> Yes, but that's the point isn't it? If Nautilus understands regular
> expressions, then instead of listing every single .pyc file by name,
> potentially thousands of them, you just need a single entry:
>
> .*pyc
>
> to hide *every* .pyc file. Or use .*py[co] for .pyc and .pyo files.
>
> If Nautilus *doesn't* understand regular expressions, well, that's just
> another example of why Gnome is not good enough for serious work.
>
> This suggests that Nautilus doesn't accept wildcards:
>
> http://ubuntuforums.org/showthread.php?t=1730696
You're right, I just tried it:
# does NOT work:
echo *.py[co] > .hidden
# works (but you need a cronjob):
ls *.py[co] > .hidden
I just created an alias for this:
alias hidepycs="ls *.py[co] > .hidden"
No idea whether there exists some sneaky way to make Nautilius understand regexes. I could make an enhancement request, but with Debian this would become effective like 15 years later :-)
regards,
Albert-Jan
More information about the Tutor
mailing list