LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-21-2021, 09:06 AM   #16
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,699

Rep: Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972

Quote:
Originally Posted by Turbocapitalist View Post
I would make a shell script which uses stat to find the sizes of the two files, compare the results, and then copy if the one is larger. For that you'll probably need command substitution, depending on how you approach it.

You posted two links which almost do that in #5 above. Please say what is wrong with the second link, I mean in addition to it parsing of ls output.
Yep; if the OP bothered to put in the search term I gave them, and read the resulting first link, it would have given them this:
Code:
for x in $(ls -1 home/me/local/folder/*)
do
    eachsize=$(stat -c "%s")
    rsync -avz --progress --max-size=${eachsize} remote:/home/you/folder/${x} .
done
...which does EXACTLY what they're after. Pretty clear the OP put no effort into finding/modifying/writing their own solution.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Overwrite 1st Byte only of every Sector goodsignal Programming 5 06-23-2017 04:32 PM
How to overwrite existing files by using tar command (Remove extra files) Kalibo Linux - Newbie 9 12-26-2013 12:42 AM
[SOLVED] PHP File open larger files or fopen files larger than 2gigs Nemus Linux - Server 6 02-18-2011 01:03 AM
Failed to overwrite statefile "Read only file-system" Bviper Linux - Networking 5 01-05-2010 07:40 PM
How do I move files without overwrite exitng files? nadavvin Linux - General 10 11-03-2006 02:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration