Here's a list of books from 2010 that every entrepreneur must read: 10 Books Every Entrepreneur Must Read From 2010
./M6
Starting Up: What I Wish Someone Had Told Me 4 Years Ago
Great post about starting up.
Core message: focus and do it. Need some inspiration? Just think you're Milton from Office Space, tucked in the corner cubicle of Innotech, staring at the red stapler, and waiting for your next pay check.
What I Wish Someone Had Told Me 4 Years Ago
./M6
Core message: focus and do it. Need some inspiration? Just think you're Milton from Office Space, tucked in the corner cubicle of Innotech, staring at the red stapler, and waiting for your next pay check.
What I Wish Someone Had Told Me 4 Years Ago
./M6
How to write a simple operating system
I was reading Hacker Montly and found this interesting step-by-step article in issue 10 about How to write a simple operating system.
./M6
./M6
Startup Marketing by Hacker Monthly
Hacker Monthly has a special, free, edition about Startup Marketing.
I trully recomend it for all entrepreneurs.
./M6
I trully recomend it for all entrepreneurs.
./M6
Automatic FTP
I currently need to upload of some text files via FTP, but since some files are big, over 5Gb, I get a lot timeouts, which stops me from using the FTP mput command.
So, I've developed a small Python script to automate this task and avoid the timeouts.
It has the following features:
After setting things up for one's needs, it's quite easy to use.
To transfer all .txt files starting with "A" from the default local directory, just:
To transfer all .xml files from a specific directory "Z:\test", just:
If one needs to adapt this to either get file, i.e. download, or to support binary file, just check the Python ftplib documentation, it's quite easy.
./M6
So, I've developed a small Python script to automate this task and avoid the timeouts.
It has the following features:
- can be scheduled;
- accepts file masks;
- assumes a default local directory where the files to be uploaded are located;
- supports text files only;
- opens the connection for each file transfer in order to avoid timeout problems;
# -*- coding: iso-8859-15 -*-
'''
Automatic FTP
'''
import sys
import string
import ftplib
import os
import glob
import datetime
# Server name or IP address
__SERVER = "server.com"
# FTP username
__USER = "username"
# FTP password
__PASSWORD = "password"
# Default local directory were files are located to be uploaded
__DEFAULT_LOCATION = "C:\\ftp\\upload"
#
# Shows the time difference.
#
def showTimeDifference(init):
td = datetime.datetime.now()-init
print "in",td.seconds,"seconds (",td.seconds/60," minutes )."
#
# Transfers the files
#
def transferFile(ftpFile):
ftpInit = datetime.datetime.now()
file = os.path.basename(ftpFile)
print "\tTransfering:",file,
ftp = ftplib.FTP(__SERVER)
ftp.login(__USER, __PASSWORD)
ftp.storlines("STOR " + str(file).upper(), open(ftpFile))
ftp.close()
showTimeDifference(ftpInit)
print ""
#
# Get the files to transfer
#
def getTransferFiles(location, mask):
result = []
for file in glob.glob1(location, mask):
result.append(os.path.join(location, file))
return result
#
# Main
#
def main(args):
fileMask = ""
fileLocation = __DEFAULT_LOCATION
if len(args) == 2:
fileMask = sys.argv[1]
elif len(args) == 3:
fileMask = args[1]
fileLocation = args[2]
else:
print "autoFTP filemask [location]"
sys.exit(0)
print "Transfer files from",fileLocation,"to", __SERVER,"..."
ftpInit = datetime.datetime.now()
for file in getTransferFiles(fileLocation, fileMask):
transferFile(file)
print "Transfer competed",
showTimeDifference(ftpInit)
#
# Main
#
main(sys.argv)
After setting things up for one's needs, it's quite easy to use.
To transfer all .txt files starting with "A" from the default local directory, just:
python autoFTP A*.txt
To transfer all .xml files from a specific directory "Z:\test", just:
python autoFTP *.xml Z:\test
If one needs to adapt this to either get file, i.e. download, or to support binary file, just check the Python ftplib documentation, it's quite easy.
./M6
Subscribe to:
Posts (Atom)