How to auto delete removed file's undo/backup ?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

How to auto delete removed file's undo/backup ?

Linus Boyle
Hello all,

I have setting in my .vimrc to put all the undo/backup in a specific folder. And now it has taken up too much space(around a hundred megabytes, say). Many files are no longer needed because the original file has been removed. I'm not good at scripting and all I come up with is to parse the filename and test its existence. So I'm wondering if there're easy ways to clean them up.  any suggestion is welcome

Best Regards,
Linus Boyle

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to auto delete removed file's undo/backup ?

Shlomi Fish-2
Hi Linus!

On Fri, 30 Nov 2018 23:41:24 -0800 (PST)
Linus Boyle <[hidden email]> wrote:

> Hello all,
>
> I have setting in my .vimrc to put all the undo/backup in a specific folder.
> And now it has taken up too much space(around a hundred megabytes, say). Many
> files are no longer needed because the original file has been removed. I'm
> not good at scripting and all I come up with is to parse the filename and
> test its existence. So I'm wondering if there're easy ways to clean them up.
> any suggestion is welcome
>

what is your OS and preferred scripting language / environment? See
https://www.quotes.net/quote/34583 .
> Best Regards,
> Linus Boyle
>



--
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
What does “Zionism” mean? - http://shlom.in/def-zionism

In the beginning the Universe was created. This has made a lot of people very
angry and been widely regarded as a bad move.
    — https://en.wikiquote.org/wiki/The_Hitchhiker's_Guide_to_the_Galaxy

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to auto delete removed file's undo/backup ?

Linus Boyle
Hi Shlomi,

thx for your humour, lol. I use GNU/linux, and maybe bash script can handle this quite well.

I'm just wondering if I can achieve my goal easily, before I get my hand dirty to write the script.

Shlomi Fish <[hidden email]> 于2018年12月1日周六 下午5:58写道:
Hi Linus!

On Fri, 30 Nov 2018 23:41:24 -0800 (PST)
Linus Boyle <[hidden email]> wrote:

> Hello all,
>
> I have setting in my .vimrc to put all the undo/backup in a specific folder.
> And now it has taken up too much space(around a hundred megabytes, say). Many
> files are no longer needed because the original file has been removed. I'm
> not good at scripting and all I come up with is to parse the filename and
> test its existence. So I'm wondering if there're easy ways to clean them up.
> any suggestion is welcome
>

what is your OS and preferred scripting language / environment? See
https://www.quotes.net/quote/34583 .
> Best Regards,
> Linus Boyle
>



--
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
What does “Zionism” mean? - http://shlom.in/def-zionism

In the beginning the Universe was created. This has made a lot of people very
angry and been widely regarded as a bad move.
    — https://en.wikiquote.org/wiki/The_Hitchhiker's_Guide_to_the_Galaxy

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to auto delete removed file's undo/backup ?

Shlomi Fish-2
Hi Linus,

On Sat, 1 Dec 2018 18:56:47 +0800
Linus Boyle <[hidden email]> wrote:

> Hi Shlomi,
>
> thx for your humour, lol. I use GNU/linux, and maybe bash script can handle
> this quite well.
>
> I'm just wondering if I can achieve my goal easily, before I get my hand
> dirty to write the script.
>

see
https://unix.stackexchange.com/questions/92346/why-does-find-mtime-1-only-return-files-older-than-2-days
and -print0 and https://en.wikipedia.org/wiki/Xargs -0.


> Shlomi Fish <[hidden email]> 于2018年12月1日周六 下午5:58写道:
>
> > Hi Linus!
> >
> > On Fri, 30 Nov 2018 23:41:24 -0800 (PST)
> > Linus Boyle <[hidden email]> wrote:
> >  
> > > Hello all,
> > >
> > > I have setting in my .vimrc to put all the undo/backup in a specific  
> > folder.  
> > > And now it has taken up too much space(around a hundred megabytes, say).  
> > Many  
> > > files are no longer needed because the original file has been removed.  
> > I'm  
> > > not good at scripting and all I come up with is to parse the filename and
> > > test its existence. So I'm wondering if there're easy ways to clean them  
> > up.  
> > > any suggestion is welcome
> > >  
> >
> > what is your OS and preferred scripting language / environment? See
> > https://www.quotes.net/quote/34583 .  
> > > Best Regards,
> > > Linus Boyle
> > >  
> >
> >
> >
> > --
> > -----------------------------------------------------------------
> > Shlomi Fish       http://www.shlomifish.org/
> > What does “Zionism” mean? - http://shlom.in/def-zionism
> >
> > In the beginning the Universe was created. This has made a lot of people
> > very
> > angry and been widely regarded as a bad move.
> >     — https://en.wikiquote.org/wiki/The_Hitchhiker's_Guide_to_the_Galaxy
> >
> > Please reply to list if it's a mailing list post - http://shlom.in/reply .
> >
> > --
> > --
> > You received this message from the "vim_use" maillist.
> > Do not top-post! Type your reply below the text you are replying to.
> > For more information, visit http://www.vim.org/maillist.php
> >
> > ---
> > You received this message because you are subscribed to the Google Groups
> > "vim_use" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to [hidden email].
> > For more options, visit https://groups.google.com/d/optout.
> >  
>



--
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
What does “Zionism” mean? - http://shlom.in/def-zionism

Hacker sees bug. Hacker does not want bug. Hacker fixes bug.
    — http://www.shlomifish.org/humour.html

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to auto delete removed file's undo/backup ?

Linus Boyle
Thank you, Shlomi. This helps me a lot.

Shlomi Fish <[hidden email]> 于2018年12月1日周六 下午7:24写道:
Hi Linus,

On Sat, 1 Dec 2018 18:56:47 +0800
Linus Boyle <[hidden email]> wrote:

> Hi Shlomi,
>
> thx for your humour, lol. I use GNU/linux, and maybe bash script can handle
> this quite well.
>
> I'm just wondering if I can achieve my goal easily, before I get my hand
> dirty to write the script.
>

see
https://unix.stackexchange.com/questions/92346/why-does-find-mtime-1-only-return-files-older-than-2-days
and -print0 and https://en.wikipedia.org/wiki/Xargs -0.


> Shlomi Fish <[hidden email]> 于2018年12月1日周六 下午5:58写道:
>
> > Hi Linus!
> >
> > On Fri, 30 Nov 2018 23:41:24 -0800 (PST)
> > Linus Boyle <[hidden email]> wrote:
> > 
> > > Hello all,
> > >
> > > I have setting in my .vimrc to put all the undo/backup in a specific 
> > folder. 
> > > And now it has taken up too much space(around a hundred megabytes, say). 
> > Many 
> > > files are no longer needed because the original file has been removed. 
> > I'm 
> > > not good at scripting and all I come up with is to parse the filename and
> > > test its existence. So I'm wondering if there're easy ways to clean them 
> > up. 
> > > any suggestion is welcome
> > > 
> >
> > what is your OS and preferred scripting language / environment? See
> > https://www.quotes.net/quote/34583
> > > Best Regards,
> > > Linus Boyle
> > > 
> >
> >
> >
> > --
> > -----------------------------------------------------------------
> > Shlomi Fish       http://www.shlomifish.org/
> > What does “Zionism” mean? - http://shlom.in/def-zionism
> >
> > In the beginning the Universe was created. This has made a lot of people
> > very
> > angry and been widely regarded as a bad move.
> >     — https://en.wikiquote.org/wiki/The_Hitchhiker's_Guide_to_the_Galaxy
> >
> > Please reply to list if it's a mailing list post - http://shlom.in/reply .
> >
> > --
> > --
> > You received this message from the "vim_use" maillist.
> > Do not top-post! Type your reply below the text you are replying to.
> > For more information, visit http://www.vim.org/maillist.php
> >
> > ---
> > You received this message because you are subscribed to the Google Groups
> > "vim_use" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to [hidden email].
> > For more options, visit https://groups.google.com/d/optout.
> > 
>



--
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
What does “Zionism” mean? - http://shlom.in/def-zionism

Hacker sees bug. Hacker does not want bug. Hacker fixes bug.
    — http://www.shlomifish.org/humour.html

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to auto delete removed file's undo/backup ?

Shlomi Fish-2
On Sat, 1 Dec 2018 21:41:15 +0800
Linus Boyle <[hidden email]> wrote:

> Thank you, Shlomi. This helps me a lot.
>

You are welcome.


--
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
http://youtu.be/KxGRhd_iWuE - Never Give Up!!

<Su-Shee> Also, .* is the most unspecific regex you can use. It’s like saying:
oh well match something of anything or nothing, and, please, a lot of it ;)

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to auto delete removed file's undo/backup ?

Ruben Safir
In reply to this post by Linus Boyle
how did it help you.  You asked about history tmp files and the response
was completely irrelevant.  Clue the rest of us in?


On 12/1/18 8:41 AM, Linus Boyle wrote:

> Thank you, Shlomi. This helps me a lot.
>
> Shlomi Fish <[hidden email]> 于2018年12月1日周六 下午7:24写道:
>
>> Hi Linus,
>>
>> On Sat, 1 Dec 2018 18:56:47 +0800
>> Linus Boyle <[hidden email]> wrote:
>>
>>> Hi Shlomi,
>>>
>>> thx for your humour, lol. I use GNU/linux, and maybe bash script can
>> handle
>>> this quite well.
>>>
>>> I'm just wondering if I can achieve my goal easily, before I get my hand
>>> dirty to write the script.
>>>
>>
>> see
>>
>> https://unix.stackexchange.com/questions/92346/why-does-find-mtime-1-only-return-files-older-than-2-days
>> and -print0 and https://en.wikipedia.org/wiki/Xargs -0.
>>
>>
>>> Shlomi Fish <[hidden email]> 于2018年12月1日周六 下午5:58写道:
>>>
>>>> Hi Linus!
>>>>
>>>> On Fri, 30 Nov 2018 23:41:24 -0800 (PST)
>>>> Linus Boyle <[hidden email]> wrote:
>>>>
>>>>> Hello all,
>>>>>
>>>>> I have setting in my .vimrc to put all the undo/backup in a
>> specific
>>>> folder.
>>>>> And now it has taken up too much space(around a hundred megabytes,
>> say).
>>>> Many
>>>>> files are no longer needed because the original file has been
>> removed.
>>>> I'm
>>>>> not good at scripting and all I come up with is to parse the
>> filename and
>>>>> test its existence. So I'm wondering if there're easy ways to clean
>> them
>>>> up.
>>>>> any suggestion is welcome
>>>>>
>>>>
>>>> what is your OS and preferred scripting language / environment? See
>>>> https://www.quotes.net/quote/34583 .
>>>>> Best Regards,
>>>>> Linus Boyle
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> -----------------------------------------------------------------
>>>> Shlomi Fish       http://www.shlomifish.org/
>>>> What does “Zionism” mean? - http://shlom.in/def-zionism
>>>>
>>>> In the beginning the Universe was created. This has made a lot of
>> people
>>>> very
>>>> angry and been widely regarded as a bad move.
>>>>     —
>> https://en.wikiquote.org/wiki/The_Hitchhiker's_Guide_to_the_Galaxy
>>>>
>>>> Please reply to list if it's a mailing list post -
>> http://shlom.in/reply .
>>>>
>>>> --
>>>> --
>>>> You received this message from the "vim_use" maillist.
>>>> Do not top-post! Type your reply below the text you are replying to.
>>>> For more information, visit http://www.vim.org/maillist.php
>>>>
>>>> ---
>>>> You received this message because you are subscribed to the Google
>> Groups
>>>> "vim_use" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>> an
>>>> email to [hidden email].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>
>>
>>
>> --
>> -----------------------------------------------------------------
>> Shlomi Fish       http://www.shlomifish.org/
>> What does “Zionism” mean? - http://shlom.in/def-zionism
>>
>> Hacker sees bug. Hacker does not want bug. Hacker fixes bug.
>>     — http://www.shlomifish.org/humour.html
>>
>> Please reply to list if it's a mailing list post - http://shlom.in/reply .
>>
>> --
>> --
>> You received this message from the "vim_use" maillist.
>> Do not top-post! Type your reply below the text you are replying to.
>> For more information, visit http://www.vim.org/maillist.php
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "vim_use" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [hidden email].
>> For more options, visit https://groups.google.com/d/optout.
>>
>


--
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com

DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive
http://www.coinhangout.com - coins!
http://www.brooklyn-living.com

Being so tracked is for FARM ANIMALS and and extermination camps,
but incompatible with living as a free human being. -RI Safir 2013

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to auto delete removed file's undo/backup ?

Linus Boyle
Hi Ruben,

Shlomi just told me how to find history tmp files that are no longer needed. At the beginning I want to remove these tmp files if the original one no longer exists. But Shlomi's solution might be better: he suggested removing a file only if it has not been modified for some time.

It's my fault, it's actually not a vim-relevant question. I think it's more like a scripting problem to me. sorry for that.

Best Regards,
Linus Boyle

Ruben Safir <[hidden email]> 于2018年12月2日周日 上午6:40写道:
how did it help you.  You asked about history tmp files and the response
was completely irrelevant.  Clue the rest of us in?


On 12/1/18 8:41 AM, Linus Boyle wrote:
> Thank you, Shlomi. This helps me a lot.
>
> Shlomi Fish <[hidden email]> 于2018年12月1日周六 下午7:24写道:
>
>> Hi Linus,
>>
>> On Sat, 1 Dec 2018 18:56:47 +0800
>> Linus Boyle <[hidden email]> wrote:
>>
>>> Hi Shlomi,
>>>
>>> thx for your humour, lol. I use GNU/linux, and maybe bash script can
>> handle
>>> this quite well.
>>>
>>> I'm just wondering if I can achieve my goal easily, before I get my hand
>>> dirty to write the script.
>>>
>>
>> see
>>
>> https://unix.stackexchange.com/questions/92346/why-does-find-mtime-1-only-return-files-older-than-2-days
>> and -print0 and https://en.wikipedia.org/wiki/Xargs -0.
>>
>>
>>> Shlomi Fish <[hidden email]> 于2018年12月1日周六 下午5:58写道:
>>>
>>>> Hi Linus!
>>>>
>>>> On Fri, 30 Nov 2018 23:41:24 -0800 (PST)
>>>> Linus Boyle <[hidden email]> wrote:
>>>>
>>>>> Hello all,
>>>>>
>>>>> I have setting in my .vimrc to put all the undo/backup in a
>> specific
>>>> folder.
>>>>> And now it has taken up too much space(around a hundred megabytes,
>> say).
>>>> Many
>>>>> files are no longer needed because the original file has been
>> removed.
>>>> I'm
>>>>> not good at scripting and all I come up with is to parse the
>> filename and
>>>>> test its existence. So I'm wondering if there're easy ways to clean
>> them
>>>> up.
>>>>> any suggestion is welcome
>>>>>
>>>>
>>>> what is your OS and preferred scripting language / environment? See
>>>> https://www.quotes.net/quote/34583 .
>>>>> Best Regards,
>>>>> Linus Boyle
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> -----------------------------------------------------------------
>>>> Shlomi Fish       http://www.shlomifish.org/
>>>> What does “Zionism” mean? - http://shlom.in/def-zionism
>>>>
>>>> In the beginning the Universe was created. This has made a lot of
>> people
>>>> very
>>>> angry and been widely regarded as a bad move.
>>>>     —
>> https://en.wikiquote.org/wiki/The_Hitchhiker's_Guide_to_the_Galaxy
>>>>
>>>> Please reply to list if it's a mailing list post -
>> http://shlom.in/reply .
>>>>
>>>> --
>>>> --
>>>> You received this message from the "vim_use" maillist.
>>>> Do not top-post! Type your reply below the text you are replying to.
>>>> For more information, visit http://www.vim.org/maillist.php
>>>>
>>>> ---
>>>> You received this message because you are subscribed to the Google
>> Groups
>>>> "vim_use" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>> an
>>>> email to [hidden email].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>
>>
>>
>> --
>> -----------------------------------------------------------------
>> Shlomi Fish       http://www.shlomifish.org/
>> What does “Zionism” mean? - http://shlom.in/def-zionism
>>
>> Hacker sees bug. Hacker does not want bug. Hacker fixes bug.
>>     — http://www.shlomifish.org/humour.html
>>
>> Please reply to list if it's a mailing list post - http://shlom.in/reply .
>>
>> --
>> --
>> You received this message from the "vim_use" maillist.
>> Do not top-post! Type your reply below the text you are replying to.
>> For more information, visit http://www.vim.org/maillist.php
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "vim_use" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [hidden email].
>> For more options, visit https://groups.google.com/d/optout.
>>
>


--
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com

DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive
http://www.coinhangout.com - coins!
http://www.brooklyn-living.com

Being so tracked is for FARM ANIMALS and and extermination camps,
but incompatible with living as a free human being. -RI Safir 2013

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to auto delete removed file's undo/backup ?

Lifepillar
In reply to this post by Ruben Safir
On 2018-12-01, Ruben Safir <[hidden email]> wrote:
> how did it help you.  You asked about history tmp files and the response
> was completely irrelevant.  Clue the rest of us in?

FWIW, I have this command in my vimrc:

  " Clean up old undo files
  command! -nargs=0 CleanUpUndoFiles
    \ !find ~/.vim/tmp/undo -type f
    \ -mtime +100d \! -name '.gitignore' -delete

Explanation:

!find ~/.vim/tmp/undo: find files in ~/.vim/tmp/undo...
-type f: ...which are files (not directories)...
-mtime +100d: ...and which are ~3 months old...
-delete: ...and delete them...
\! -name '.gitgnore': ...but do not touch `.gitignore`.

Btw, now that Vim has jobs, it would be nice if it had an option to
perform clean up tasks like this in the background.

Enjoy,
Life.


--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.