LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   files back-ups (https://www.linuxquestions.org/questions/linux-desktop-74/files-back-ups-572037/)

replica9000 07-24-2007 09:30 PM

files back-ups
 
You know how Linux makes a back-up file every time a file is edited, is there a way to have that file saved to a specified folder instead of it always being saved in the original file's directory?

I'm using KDE if that matters...

gd2shoe 07-25-2007 02:27 AM

It doesn't so much matter that you are using kde, as it does matter which program you are using. If you are using kwrite, then no, I don't think so. On the bright side, if you are just trying to avoid the clutter, there is something you can do with kwrite: Settings-> configure editor-> Open/Save-> Prefix = .
If the Prefix setting is comprised of a single period, then every temporary save file will have a period added to the front of it. In unix (and linux) this will make it a hidden file. The file will still be there, but you wont normally be able to see it.

archtoad6 07-25-2007 06:05 AM

Why would you want to that? I would think that right there near the original is where it would be most useful. -- It's not that it's some kind of versioning control. One problem w/ putting them all in the same dir. is name space collision.

replica9000 07-25-2007 03:51 PM

Ok thanks, I was using Kedit to edit html files, and I didn't want a ton of back-ups floating around with the originals.

archtoad6 07-26-2007 12:05 PM

Were you getting more than 1 backup per edited file?

replica9000 07-27-2007 06:56 PM

Nope, just 1 back up per original

archtoad6 07-28-2007 09:02 AM

So the annoying "ton of back-ups" was large only because of the number of files edited.

If it's that important you could (& we could help you) write a script to delete the back-ups, it could even be set to leave newer ones. You could also put it in as a cron job.

Instead of deleting, you could just move them to a back-ups sub-dir.

replica9000 07-28-2007 06:02 PM

Quote:

Originally Posted by archtoad6
So the annoying "ton of back-ups" was large only because of the number of files edited.

If it's that important you could (& we could help you) write a script to delete the back-ups, it could even be set to leave newer ones. You could also put it in as a cron job.

Instead of deleting, you could just move them to a back-ups sub-dir.

Putting them in a back-up subdirectory is what I was hoping to do.

archtoad6 07-30-2007 08:55 AM

Do you need help writing the script?

replica9000 07-30-2007 02:51 PM

I've never tried writing a script before.

archtoad6 07-31-2007 07:23 AM

Would you like to try?

It's little more than putting the necessary commands in a file.

replica9000 08-01-2007 09:15 PM

sure always up for learning something new in Linux

archtoad6 08-02-2007 11:30 AM

Planning 1st.

Where will the script live? Will it operate only in its own dir., or will it be put someplace like /usr/local/bin?

Will it have to check for &/or make the necessary sub-dir, or can it count on that being provided?

Will it move all back up files, of only older ones?

How will it recognize back up files?


Just Start Writing

Almost self-explanatory -- what commands wold you issue on the CLI to accomplish your goal?


I suggest you try writing & posting (here, of course) the code, keeping in mind my planning Q's as well as any ideas I have overlooked. Please use LQ "Code:" blocks.

BTW, this is one of my ideas of fun. :)

archtoad6 09-23-2007 04:34 PM

Have you lost interest?

replica9000 10-04-2007 07:55 PM

Quote:

Originally Posted by archtoad6 (Post 2901388)
Have you lost interest?

Sorry for the very delayed reply. I no longer need a script for that particular need, but perhaps learning now would be useful in the future.

Is a script file just a txt file with commands in it? And what makes it executable?

I'm assuming it's not as simple as
Code:

cd /home/replica/webpages
rm *.html~



All times are GMT -5. The time now is 11:33 AM.