Skip to main content

The goal is pretty straightforward. There’s a list of dotfiles from my home directory. It loops through them and rsyncarsyncs all file to a Dropbox folder for backup purposes. A cron job runs this nightly. Code has workworked well so far.

    #!/usr/bin/python
    
    import os
    from os.path import expanduser
    import sys
    import subprocess
    
    dotfiles = [
      '.ackrc',
      '.tmux.conf',
      '.vimrc',
      '.zshrc',
      '.gitconfig',
      '.ssh/config',
      '.zsh/MyAntigen.hs',
      '.vim/colors/dracula.vim'
    ]
    
    home = expanduser("~")
    src = home + '/'
    dest = home + '/Dropbox/Dotfiles'
    rsync = 'rsync --times'
    
    if sys.stdout.isatty():
        rsync = rsync + ' --progress'
    
    for item in dotfiles:
        src_file = os.path.join(src + item)
        cmd = rsync + ' ' + src_file + ' ' + dest
        process = subprocess.Popen(cmd, shell=True)
        process.wait()

This is my very first Python script (first time using rsyncrsync too) and I just started very recently. I’ve put this together based on trial and error and a lot of Stack Overflow. So I’m here for some genuine feedback. Thanks in advance!

The goal is pretty straightforward. There’s a list of dotfiles from my home directory. It loops through them and rsynca all file to a Dropbox folder for backup purposes. A cron job runs this nightly. Code has work well so far.

    #!/usr/bin/python
    
    import os
    from os.path import expanduser
    import sys
    import subprocess
    
    dotfiles = [
      '.ackrc',
      '.tmux.conf',
      '.vimrc',
      '.zshrc',
      '.gitconfig',
      '.ssh/config',
      '.zsh/MyAntigen.hs',
      '.vim/colors/dracula.vim'
    ]
    
    home = expanduser("~")
    src = home + '/'
    dest = home + '/Dropbox/Dotfiles'
    rsync = 'rsync --times'
    
    if sys.stdout.isatty():
        rsync = rsync + ' --progress'
    
    for item in dotfiles:
        src_file = os.path.join(src + item)
        cmd = rsync + ' ' + src_file + ' ' + dest
        process = subprocess.Popen(cmd, shell=True)
        process.wait()

This is my very first Python script (first time using rsync too) and I just started very recently. I’ve put this together based on trial and error and a lot of Stack Overflow. So I’m here for some genuine feedback. Thanks in advance!

The goal is pretty straightforward. There’s a list of dotfiles from my home directory. It loops through them and rsyncs all file to a Dropbox folder for backup purposes. A cron job runs this nightly. Code has worked well so far.

#!/usr/bin/python
    
import os
from os.path import expanduser
import sys
import subprocess
    
dotfiles = [
  '.ackrc',
  '.tmux.conf',
  '.vimrc',
  '.zshrc',
  '.gitconfig',
  '.ssh/config',
  '.zsh/MyAntigen.hs',
  '.vim/colors/dracula.vim'
]
    
home = expanduser("~")
src = home + '/'
dest = home + '/Dropbox/Dotfiles'
rsync = 'rsync --times'
    
if sys.stdout.isatty():
    rsync = rsync + ' --progress'
    
for item in dotfiles:
    src_file = os.path.join(src + item)
    cmd = rsync + ' ' + src_file + ' ' + dest
    process = subprocess.Popen(cmd, shell=True)
    process.wait()

This is my very first Python script (first time using rsync too) and I just started very recently. I’ve put this together based on trial and error and a lot of Stack Overflow. So I’m here for some genuine feedback.

deleted 7 characters in body
Source Link

The goal is pretty straightforward. There’s a list of dotfiles from my home directory. I’d like to loopIt loops through them and rsyncrsynca all file to a Dropbox folder for backup purposes. A cron job will runruns this nightly. Code has work well so far.

    #!/usr/bin/python
    
    import os
    from os.path import expanduser
    import sys
    import subprocess
    
    dotfiles = [
      '.ackrc',
      '.tmux.conf',
      '.vimrc',
      '.zshrc',
      '.gitconfig',
      '.ssh/config',
      '.zsh/MyAntigen.hs',
      '.vim/colors/dracula.vim'
    ]
    
    home = expanduser("~")
    src = home + '/'
    dest = home + '/Dropbox/Dotfiles'
    rsync = 'rsync --times'
    
    if sys.stdout.isatty():
        rsync = rsync + ' --progress'
    
    for item in dotfiles:
        src_file = os.path.join(src + item)
        cmd = rsync + ' ' + src_file + ' ' + dest
        process = subprocess.Popen(cmd, shell=True)
        process.wait()

So the code works. But thisThis is my very first Python script (first time using rsync too) and I just started very recently. I’ve put this together based on trial and error and a lot of Stack Overflow. So I’m here for some genuine feedback. Thanks in advance!

The goal is pretty straightforward. There’s a list of dotfiles from my home directory. I’d like to loop through them and rsync all file to a Dropbox folder for backup purposes. A cron job will run this nightly.

    #!/usr/bin/python
    
    import os
    from os.path import expanduser
    import sys
    import subprocess
    
    dotfiles = [
      '.ackrc',
      '.tmux.conf',
      '.vimrc',
      '.zshrc',
      '.gitconfig',
      '.ssh/config',
      '.zsh/MyAntigen.hs',
      '.vim/colors/dracula.vim'
    ]
    
    home = expanduser("~")
    src = home + '/'
    dest = home + '/Dropbox/Dotfiles'
    rsync = 'rsync --times'
    
    if sys.stdout.isatty():
        rsync = rsync + ' --progress'
    
    for item in dotfiles:
        src_file = os.path.join(src + item)
        cmd = rsync + ' ' + src_file + ' ' + dest
        process = subprocess.Popen(cmd, shell=True)
        process.wait()

So the code works. But this is my very first Python script (first time using rsync too) and I just started very recently. I’ve put this together based on trial and error and a lot of Stack Overflow. So I’m here for some genuine feedback. Thanks in advance!

The goal is pretty straightforward. There’s a list of dotfiles from my home directory. It loops through them and rsynca all file to a Dropbox folder for backup purposes. A cron job runs this nightly. Code has work well so far.

    #!/usr/bin/python
    
    import os
    from os.path import expanduser
    import sys
    import subprocess
    
    dotfiles = [
      '.ackrc',
      '.tmux.conf',
      '.vimrc',
      '.zshrc',
      '.gitconfig',
      '.ssh/config',
      '.zsh/MyAntigen.hs',
      '.vim/colors/dracula.vim'
    ]
    
    home = expanduser("~")
    src = home + '/'
    dest = home + '/Dropbox/Dotfiles'
    rsync = 'rsync --times'
    
    if sys.stdout.isatty():
        rsync = rsync + ' --progress'
    
    for item in dotfiles:
        src_file = os.path.join(src + item)
        cmd = rsync + ' ' + src_file + ' ' + dest
        process = subprocess.Popen(cmd, shell=True)
        process.wait()

This is my very first Python script (first time using rsync too) and I just started very recently. I’ve put this together based on trial and error and a lot of Stack Overflow. So I’m here for some genuine feedback. Thanks in advance!

Source Link

Loop through array of files and rsync to Dropbox

The goal is pretty straightforward. There’s a list of dotfiles from my home directory. I’d like to loop through them and rsync all file to a Dropbox folder for backup purposes. A cron job will run this nightly.

    #!/usr/bin/python
    
    import os
    from os.path import expanduser
    import sys
    import subprocess
    
    dotfiles = [
      '.ackrc',
      '.tmux.conf',
      '.vimrc',
      '.zshrc',
      '.gitconfig',
      '.ssh/config',
      '.zsh/MyAntigen.hs',
      '.vim/colors/dracula.vim'
    ]
    
    home = expanduser("~")
    src = home + '/'
    dest = home + '/Dropbox/Dotfiles'
    rsync = 'rsync --times'
    
    if sys.stdout.isatty():
        rsync = rsync + ' --progress'
    
    for item in dotfiles:
        src_file = os.path.join(src + item)
        cmd = rsync + ' ' + src_file + ' ' + dest
        process = subprocess.Popen(cmd, shell=True)
        process.wait()

So the code works. But this is my very first Python script (first time using rsync too) and I just started very recently. I’ve put this together based on trial and error and a lot of Stack Overflow. So I’m here for some genuine feedback. Thanks in advance!