Copying files in Linux

apoole15apoole15 Member Posts: 64 ■■■□□□□□□□
Good morning everyone,

I am currently studying for my Linux+ and really am clueless about Linux at the moment. However, we have run into an issue at my office that I am hoping someone can provide some insight for me.

Without going into the backstory - I have a server where we need to copy approximately 50gb worth of files to a thumbdrive. We kicked off the backup and everything was copying over but about 4 hours into it, the process was stopped (manually by an admin).

Anyway, is there a way to kick off the copy using the same command but include a switch or something that tells it to only copy data that wasn't previously copied to the thumbdrive? Such as when you copy multiple files in Windows and it indicates that some of the files already exist on the thumbdrive and do you want to replace it and you can say no and it skips copying those files? We are trying to kick off the copy process again but we are not sure what has been copied and what has not and we are hoping we don't have to copy everything again.

I hope this all makes sense.

Thanks in advance!


  • Options
    webgeekwebgeek Member Posts: 495 ■■■■□□□□□□
    IIRC the cp -n should work for your needs...you could always use the man command to give you more information on the cp command
    BS in IT: Information Assurance and Security (Capella) CISSP, GIAC GSEC, Net+, A+
  • Options
    lsud00dlsud00d Member Posts: 1,571
    Yeah, the -n is no clobber...rsync offers several more options, like comparing checksums (-c), increasing the modify window when comparing timestamps between files (--modify-window=2), update (-u) skips destination files with timestamp newer than source, etc.
  • Options
    apoole15apoole15 Member Posts: 64 ■■■□□□□□□□
    Thanks guys, after doing some research I saw the -u option and I think that's the one they are going to try.
  • Options
    ally_ukally_uk Member Posts: 1,145 ■■■■□□□□□□
    Does this need to be done on a regular basis I would use rsync
    Microsoft's strategy to conquer the I.T industry

    " Embrace, evolve, extinguish "
  • Options
    ehndeehnde Member Posts: 1,103
    ally_uk wrote: »
    Does this need to be done on a regular basis I would use rsync

    Another vote for rsync, it does exactly what you are trying to do and very efficiently.
    Climb a mountain, tell no one.
  • Options
    W StewartW Stewart Member Posts: 794 ■■■■□□□□□□
    My vote goes to rsync or cp -u. I checked -n in the manpage and it doesn't look like it would account for a file that was only partially copied.
  • Options
    nogamblenogamble Member Posts: 8 ■□□□□□□□□□
    rsync is the way to go!
Sign In or Register to comment.