Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I'm writing a little script that will just cp files from one place to another. Since they will always be the exact same filename and I don't want to ever overwrite, I've been looking for a good way to autorename the files but I've been reading conflicting info.
while [[ -f "$dstdir/$dst" ]]; do
cp $srcdir/$src $dstdir/$dst
Or similar, in a loop over input files.
That one just uses a counter, but you could use whatever convention you like for preventing naming conflicts.
There's also the other way of approaching the problem...ALWAYS copy to a unique name, but first check to see if the file has changed since the previous copy was run, and if not, hard-link the old copy to the new name instead of copying it over fresh. That way you have a completely independent and separate copy of all of your files from each time the backup was run, but it only uses the disk space required for the files that changed since the last time it was run. This is what rsync's --link-dest argument does. That is assuming your objective with this is some kind of versioned backup system. It all depends on your goals.
Last edited by suicidaleggroll; 06-21-2016 at 04:07 PM.
I'm just going to separate the scripts so that each script pulls the data from only one machine, therefore I can statically assign the unique machine numbers/names to each sript. I will also need the timestamps though to keep from overwriting data previously pulled from that machine.