0

I'm really beginner in python and I have a project I want to collect and upload dotfiles to the user's GitHub account in Linux machines. So if any bad thing happens to your computer or if you want to take back your configurations you can easily reach your old dotfiles.

  #!/usr/bin/python
import glob

variable = glob.glob('/home/'hostname'/.*')

In this code, I can find the dot files but I don't know how to generate a directory with these files and upload them on the user's GitHub. And if you want to commit this opensource project here is the GitHub link: https://github.com/lvntky/DotCollector

Levent Kaya
  • 33
  • 1
  • 1
  • 7

1 Answers1

0

For the file and directory manipulation look into the Python module os. It contains commands like...

os.mkdir('/MyNewDir')
os.walk()
os.getcwd()

shutil has commands for copying files, such as...

from shutil import copyfile
src = "/home/user/dir/filename.ext"
dst = "/MyNewDir/filename.ext"
copyfile(src, dst)

For interfacing with git, look into GitPython especially paying attention to remotes.

Finally, be sure you understand how to work with github in general.

RightmireM
  • 2,381
  • 2
  • 24
  • 42